我一直在寻找一个实体映射库,这样我就不必编写大量的属性映射代码了。所以我找到了AutoMapper,AgileMapper和Mapster。在我看来,所有这些都有助于类似结构的实体。但在我的例子中,我的两个实体甚至根本不一样。一个属性,例如: public class EntityA public int PropertyA;public class EntityB public Inner1inner2
public new int Id {get;set;} public int Id {get; set;}因为我们将Id隐藏在B中,所以当将B映射到ADto时,Mapster给出了发现的模糊映射:destination=ADto ---> System.Reflection.AmbiguousMatchException(TypeTuple tuple)
at Mapster.TypeAdapt