0
我一直在尝试使用AutoMapper,但是我在配置地图时遇到了问题。AutoMapper地图复杂对象
有了这个:
public class A
{
public B b { get; set; }
public C c { get; set; }
public int id { get; set; }
public string X { get; set; }
}
public class B
{
public int id { get; set; }
public string Y { get; set; }
}
public class C
{
public int id { get; set; }
public string Z { get; set; }
}
public class ABC
{
public int Aid { get; set; }
public string AX { get; set; }
public int Bid { get; set; }
public string BY { get; set; }
public int Cid { get; set; }
public string CZ { get; set; }
}
我如何做映射A> ABC和ABC> A.
我不希望每个属性手动映射。可能吗?
谢谢。
通常,automapper要求属性名称相同。对于需要配置映射的不同名称。所以在你的情况下,你必须在automapper中映射每个属性。 –
如何更改不必配置映射? – user2653142