开发者

Override type mapping in AutoMapper

开发者 https://www.devze.com 2023-03-09 14:53 出处:网络
I\'ve got the following... Mapper.CreateMap<string, string>().ConvertUsing(x => x.Clean()); ...but I only want to use this mapping when mapping between some types. If this mapping were to

I've got the following...

Mapper.CreateMap<string, string>().ConvertUsing(x => x.Clean());

...but I only want to use this mapping when mapping between some types. If this mapping were to be the defaul开发者_运维技巧t, how could I override it for selected types?

Cheers, Ian.


Ok, new try ;)

Maybe you could use Ignore() If() and Skip() to achieve your goal. If you can figure out from the string what you should do with it.

Bit like in this question: Automapper: Ignore on condition of

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号