Is it possible to use AutoMapper with a single property? I would like to convert a string value of comma delimited values to a list of values separated by a line feed on the UI.
The current custom converters only seem to work at the class level, and because the dest and source types are both string I can't create a single map based on .
How would I apply the custom converter on a single property? Or should the custom resolver be used instead?
So, the AutoMapper Ignore() method is used when you want to completely ignore the property in the mapping. The ignored property could be in either the source or the destination object.
AutoMapper supports polymorphic arrays and collections, such that derived source/destination types are used if found.
You may use a custom resolver or map the property by calling your convert logic in a MapFrom lambda:
Mapper.CreateMap<TSource, TDest>().ForMember(dto => dto.DestPrp,
e => e.MapFrom(o => ConvertTo(o.SourceProp)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With