Entity framework 实体框架中的多对多关系不';t检索相关集合

Entity framework 实体框架中的多对多关系不';t检索相关集合,entity-framework,orm,ef-code-first,mapping,Entity Framework,Orm,Ef Code First,Mapping,我试图首先使用代码在实体框架中映射多对多SQL关系 以下是我的课程: [表(“B3_360; ViewerData”)] 公共类视图数据:实体 { //……其他财产// //导航属性 公共EntityCollection功能{get;set;} } [表(“B3_特征”)] 公共类特性:实体 { /…其他属性// //导航属性 公共ICollection ViewerData{get;set;} } 创建表[dbo]。[ViewerDataFeatures]( [Feature_Id][in

我试图首先使用代码在实体框架中映射多对多SQL关系

以下是我的课程:

[表(“B3_360; ViewerData”)]

公共类视图数据:实体
{
//……其他财产//
//导航属性
公共EntityCollection功能{get;set;}
}

[表(“B3_特征”)]

公共类特性:实体 {

/…其他属性//
//导航属性
公共ICollection ViewerData{get;set;}
}

创建表[dbo]。[ViewerDataFeatures](

[Feature_Id][int]NULL

[ViewerData_Id][int]NULL

)

该表中的插入操作与我预期的一样顺利,但是当我想要检索ViewerData实体时,我没有填充Features集合,它是null


我错过什么了吗

为什么将
EntityCollection
ICollection
混合使用?对于这两个集合,我都会尝试
ICollection
。这并不重要,因为
EntityCollection
实现
ICollection
加载
ViewerData
时是否包括
功能,比如
上下文.ViewerData.include(v=>v.Features).
public class ViewerData : Entity
 {
     //.... Other properties ...//

     // The navigation property
     public EntityCollection<Feature> Features { get; set; }
   //.... Other properties ...//
   // The navigation property
   public ICollection<ViewerData> ViewerData { get; set; }