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, a开发者_如何学Gond 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?
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)))
精彩评论