Skip to content

Nullable Support #578

Closed Answered by TimothyMakkison
AmalDarKhalil asked this question in Q&A
Jul 19, 2023 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Hey, thanks for using mapperly.

Do you have a simple example you could share or possibly the generated code? Mapperly should detect nullable members and generate conditional mapping code.
If you've recently added mapperly then sometimes restarting your ide can help.

Example nullable:

[Mapper]
public static partial class Mapper
{
    public static partial EmployeePositionDto Map(EmployeePosition car);
}

public class EmployeePosition { public PayRate? PayRate { get; set; } }

public class EmployeePositionDto { public PayRateDto PayRate { get; set; } }

public class PayRate {}

public class PayRateDto {}

Generated code

public static partial global::Riok.Mapperly.Sample.EmployeePositionDto Map(

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@AmalDarKhalil
Comment options

@TimothyMakkison
Comment options

@TimothyMakkison
Comment options

@AmalDarKhalil
Comment options

@TimothyMakkison
Comment options

Answer selected by AmalDarKhalil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants