Consider this aggregate root...
class Contact
{
ICollection Addresses { get; set; }
ICollection Items { get
The ThenInclude
pattern allows you to specify a path from the root to a single leaf, hence in order to specify a path to another leaf, you need to restart the process from the root by using the Include
method and repeat that for each leaf.
For your sample it would be like this:
Context.Set<Person>()
.Include(o => o.ContactDetails).ThenInclude(o => o.Addresses) // ContactDetails.Addresses
.Include(o => o.ContactDetails).ThenInclude(o => o.Items) // ContactDetails.Items
.Include(o => o.ContactDetails).ThenInclude(o => o.Events) // ContactDetails.Events
...
Reference: Loading Related Data - Including multiple levels