-
Thank you very much for Mapperly! Being familiar with Mapstruct in Java land it's really nice to have a C# library that has the same approach and the performance/debugging benefits mark it really appealing. I wanted to check if Mapperly already supports the ability to merge two instances of the same class, returning the target instance value for a property if the matching property in the source instance is null? I'm wanting to do something like the following:
Currently this doesn't quite work because the mapping method created ends up looking like the following which happily sets null values from the source against the target - overwriting the values I'd like to keep.
I'm hoping to be able to get a generated method that looks something like the following which will only copy the value from the source to the target if its not null:
Is this possible today using some attributes / mapping magic? If not is it an attribute or similar to support ignoring null values during source to target mapping something you'd be willing to add or have contributed to Mapperly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Thank you for your request. This is not yet implemented in Mapperly, but I think this would be a great feature. In MapStruct would you address this by using |
Beta Was this translation helpful? Give feedback.
Thank you for your request. This is not yet implemented in Mapperly, but I think this would be a great feature. In MapStruct would you address this by using
NullValuePropertyMappingStrategy.IGNORE
?