automapper - ignore mapping if property type is different with same property name - C#

后端 未结 3 1314
抹茶落季
抹茶落季 2021-01-12 03:24

How can I ignore mapping if property type is different with same property name? By default it\'s throwing error.

Mapper.CreateMap

        
3条回答
  •  旧时难觅i
    2021-01-12 04:03

    You should use ignore for properties that should be ignored:

    Mapper.CreateMap()
         ForMember(d=>d.FieldToIgnore, m=>m.Ignore());
    

提交回复
热议问题