使用Automapper 2.0映射内部对象的最佳方法是什么?
使用此问题中的解决方案(Automapper 1.0)
创建自定义值解析器
?
public class DTOObject
{
// MainObject
public int Id { get; set; }
public string Name { get; set; }
// SubObject (TopObject)
public string TopText { get; set; }
public string TopFont { get; set; }
// SubObject (BottomObject)
public string BottomText { get; set; }
public string BottomFont { get; set; }
}
public class MainObject
{
public int Id { get; set; }
public string Name { get; set; …Run Code Online (Sandbox Code Playgroud)