Consider this aggregate root...
class Contact
{
ICollection<ContactAddress> Addresses { get; set; }
ICollection<ContactItem> Items { get; set; }
ICollection<ContactEvent> Events { get; set; }
}
...which I have used like so...
class Person
{
Contact ContactDetails { get; set; }
}
How do I eager load all of the collections with the contact?
I tried this...
Context
.Set<Person>()
.Include(o => o.ContactDetails)
.ThenInclude(o => o.Addresses)
.ThenInclude(????)
. ...
I've also tried this...
Context
.Set<Business>()
.Include(o => o.ContactDetails.Addresses)
.Include(o => o.ContactDetails.Events)
.Include(o => o.ContactDetails.Items)
On a somewhat related note, is it possible to express what should be returned as part of an aggregate root using fluent configuration?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…