cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 120 forks source link

Conditional mapping #114

Closed spmoran-blazor closed 4 years ago

spmoran-blazor commented 4 years ago

Hi. How can we do condition mapping to handle nulls into a dto? Is there any real documentation?

cezarypiatek commented 4 years ago

Hi, Can you provide a sample definition of the source and destination types and expected mapping code as well?

spmoran-blazor commented 4 years ago

This was more about how to handle nulls inside nested objects. I decided to do null checks in the objects and and set variables based on the results instead of directly referencing entity.whatever. That works fine. You can close this if you like. Thanks for this great tool!