且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Automapper v5忽略未映射的属性

更新时间:2022-06-25 20:13:33

您可以使用新的CreateMap方法参数来执行此操作,然后指定所需的验证.

You can do that using the new CreateMap method parameter, and specify the validation that you want.

CreateMap<TSource, TDestination>(MemberList.None)

MemberList.None 应该可以解决问题.您还可以在源验证或目标验证之间切换.

The MemberList.None should do the trick. You can also switch between the source or destination validations.

自动映射器-选择要验证的成员