Automapper 学习笔记
本文基于 Automapper 9.0.0
诊断 Automapper 的属性映射过程
| |
最关键的一行代码 var executionPlan = configuration.BuildExecutionPlan(typeof(TypeB), typeof(TypeA));,此时查看 executionPlan 可以看到它对应的表达式树解析,看到属性如何映射。这里有个小技巧,安装 Visual Studio 插件 ReadableExpressions VS extension 可以更清晰的看到表达式树解析。需要注意应该在正式发布时移除所有的调试代码。