是否有某种方式来获得automapper一些细节时,我得到这个异常:如何调试AutoMapper.AutoMapperMappingException
AutoMapper.AutoMapperMappingException
通常它会告诉我这2种类型的映射,但没有哪解析器或者部分映射失败。
是否有某种方式来获得automapper一些细节时,我得到这个异常:如何调试AutoMapper.AutoMapperMappingException
AutoMapper.AutoMapperMappingException
通常它会告诉我这2种类型的映射,但没有哪解析器或者部分映射失败。
答案很简单,就是调用此方法,最好是在你的单元测试。
// ensure your configuration mappings are loaded first (bootstrapper)
Mapper.AssertConfigurationIsValid();
见:http://automapper.codeplex.com/wikipage?title=Getting%20Started&referringTitle=Home是固定我的问题是加入这行来映射
一件事。
.ForAllMembers(op=>op.Condition(x=>!x.IsSourceValueNull));
不知道为什么这不是默认行为。
我们得到了可空类型所以它是默认有时也把它们映射:)默认就是映射所有的东西,甚至空。 – 2016-01-20 15:01:37