Is there any optimizing I can do to avoid timeout.
]]>ApplicationDbContext.Entry(MyEntity).Collection(x => x.MyMainCollection)
.Query()
.Include(y=>y.MySubCollection)
.Load();
Customer customer = await dbcontext.Customers
.Include(cust => cust.pets)
.ThenInclude(pet => pet.Notes)
.FirstOrDefaultAsync(f => f.Id == id);
If using Explicit Loading we could load the entity first this:
Customer customer = await db.Customers .FirstOrDefaultAsync(f => f.Id == id);
db.Entry(customer).Collection(r => r.Pets).Load();
foreach (Pet pet in customer.Pets)
{
db.Entry(pet).Collection(c => c.HealthIssues).Load();
}
First, we loaded the customer, then we loaded the Pets for this customer, then for each pet, we loaded the Healt Issues of the pet.
]]>