EF Core Collection Load .. of a Collection

前端 未结 1 1394
小蘑菇
小蘑菇 2021-02-08 13:54

Using EF Core 1.1.0

I have a model that has collections that themselves have collections.

public class A {  
  public string Ay {get;set;}    
  public L         


        
1条回答
  •  时光说笑
    2021-02-08 14:24

    Fortunately you have an option. Instead of directly calling Load, you can use Query method and apply as many Include / ThenInclude as you wish.

    For your sample, it would be something like this:

    context.Entry(A).Collection(a => a.Bees)
        .Query()
        .Include(b => b.Seas).ThenInclude(c => c.Sigh)...
        .Load();
    

    0 讨论(0)
提交回复
热议问题