Entity framework EF-从上下文访问派生类型

Entity framework EF-从上下文访问派生类型,entity-framework,entity-framework-6,Entity Framework,Entity Framework 6,这是我的问题的一个例子。这是我的EF课程 public class basetype{ } public class derived : basetype{ } 是否有任何方法可以通过以下方式直接从数据库上下文访问派生实体 context.derived.Where(c=> c. whatever...); 当使用上下文时,我只能看到 context.basetype 您是否尝试过“OfType”(例如,context.baseTypeEntities.OfType()。其中(…)

这是我的问题的一个例子。这是我的EF课程

public class basetype{
}

public class derived : basetype{
}
是否有任何方法可以通过以下方式直接从数据库上下文访问派生实体

context.derived.Where(c=> c. whatever...);
当使用上下文时,我只能看到

context.basetype

您是否尝试过“OfType”(例如,
context.baseTypeEntities.OfType()。其中(…)
)?是的,但我更关心的是,如果我与另一个实体关联,而该实体是从同一基类派生的不同类型,那么处理起来会很困难。比如。。。context.basetype.TypeOf().First().NavigationPropertyBackToBaseClass.SomePropertyOfThatDerivedType,因为导航属性只返回到基类,我需要直接访问导航属性中Id为的派生类型