Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Automapper基类型、dervied类型DTO映射_Automapper_Automapper 6 - Fatal编程技术网

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来做,否则。。。