Entity framework 在实体框架Include()中使用即时加载加载加载chlid数据

Entity framework 在实体框架Include()中使用即时加载加载加载chlid数据,entity-framework,entity-framework-6,lazy-loading,eager-loading,Entity Framework,Entity Framework 6,Lazy Loading,Eager Loading,我想使用渴望加载从实体框架中的表中加载子数据,但没有得到期望的结果。我需要tb\u Event数据,然后是此表引用的客户数据,然后是EventLocation表中的数据,最后是tb\u Facility和tb\u Location中基于tb\u EventLocation的数据 这就是我所做的-直到eventlocation我获得了正确的数据,但在tb\u location和tb\u Facility中,我获得了循环依赖性。请帮忙 public IQueryable<tb_Event>

我想使用渴望加载从实体框架中的表中加载子数据,但没有得到期望的结果。我需要
tb\u Event
数据,然后是此表引用的客户数据,然后是
EventLocation
表中的数据,最后是
tb\u Facility
tb\u Location
中基于
tb\u EventLocation
的数据

这就是我所做的-直到
eventlocation
我获得了正确的数据,但在
tb\u location
tb\u Facility
中,我获得了循环依赖性。请帮忙

public IQueryable<tb_Event> Gettb_Event(){

    db.Configuration.ProxyCreationEnabled = false;
    return db.tb_Event
        .Include(tb_Event=> tb_Event.tb_Customer)
        .Include("tb_Event=>tb_Event.tb_EventLocation")
        .Include("tb_EventLocation.tb_Location")
        .Include("tb_EventLocation.tb_Facility");
}
public IQueryable Gettb_事件(){
db.Configuration.ProxyCreationEnabled=false;
返回db.tb_事件
.Include(tb\U事件=>tb\U事件.tb\U客户)
.包括(“tb\U事件=>tb\U事件.tb\U事件位置”)
.Include(“tb_EventLocation.tb_Location”)
。包括(“tb_EventLocation.tb_Facility”);
}
您需要使用
.Include(tb_事件=>tb_事件.tb_客户)。然后Include(“tb_事件=>tb_事件.tb_事件位置”)…
public IQueryable Gettb_事件(){db.Configuration.ProxyCreationEnabled=false;返回db.tb_事件。Include(e=>e.tb_客户)。Include(e=>e.tb_EventLocation.Select(el=>el.tb_Location)).Include(e=>e.tb_EventLocation.Select(el=>el.tb_Facility));}这行得通吗???@M.Wiśnicki
。然后Include()
将从最后一个
。然后Include()
或最后一个
。Include()。然后Include()没有为我显示。@M.WiśnickiI认为
.thenclude()
仅在EF Core中可用。请尝试使用
.Include(tb_Event=>tb_Event.tb_EventLocation.tb_Location)和.Include(tb_Event=>tb_Event.tb_EventLocation.tb_Facility);