如何调试AutoMapper.AutoMapperMappingException [英] How do I debug AutoMapper.AutoMapperMappingException

查看:164
本文介绍了如何调试AutoMapper.AutoMapperMappingException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我收到此异常时,是否有某种方法可以从automapper中获取更多详细信息:

Is there some way to get some more detail from automapper when I get this exception:

AutoMapper.AutoMapperMappingException

通常它会告诉我这两种映射类型,但是不会告诉我哪个解析器或部分映射失败.

Often it will tell me the 2 types of the mapping, but not which resolver or part of the mapping is failing.

推荐答案

简单的答案是,最好在您的单元测试中调用此方法.

Simple answer, is to call this method, preferably in your unit test.

// ensure your configuration mappings are loaded first (bootstrapper)
Mapper.AssertConfigurationIsValid();

请参阅: http ://docs.automapper.org/en/stable/Getting-started.html#how-do-i-test-my-mappings

这篇关于如何调试AutoMapper.AutoMapperMappingException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆