Automapper基类型、dervied类型DTO映射
我有以下课程:Automapper基类型、dervied类型DTO映射,automapper,automapper-6,Automapper,Automapper 6,我有以下课程: public class Entity { } public class Company : Entity { } public class Person : Entity { } public class SomeOther { public Entity A { get; set; } } 以及下列数码地面操作系统: public class EntityDTO { } public class SomeOtherDTO { public Entity
public class Entity
{
}
public class Company : Entity
{
}
public class Person : Entity
{
}
public class SomeOther
{
public Entity A { get; set; }
}
以及下列数码地面操作系统:
public class EntityDTO
{
}
public class SomeOtherDTO
{
public EntityDTO A { get; set; }
}
以及以下映射:
CreateMap<Person, EntityDTO>();
CreateMap<Company, EntityDTO>();
CreateMap();
CreateMap();
有没有办法执行
CreateMap()
并告诉Automapper使用基于派生类型的相关映射?我应该提到我正在使用可查询扩展(projectto)。这似乎不适用于上面链接Yes中的示例,因为EF6并不真正支持这一点。尝试编写一个查询,在没有AM的情况下执行所需的操作。如果这有效,那么你也可以用AM来做,否则。。。