There are three EF entities:
public User { public int ID {get;set;} public string Name {get;set;} public virtual ICollection<Permission> Permissions; } public Permission { public int ID {get;set;} public string Name {get;set;} public virtual ICollection<User> Users; public virtual ICollection<Domain> Domains; } public Domain { public int ID {get;set;}; public string Name {get;set;} public int PermissionID {get;set;} public Permission Permission {get;set;} } The project uses Code First. As you can see, entities are related by relationships:
User ** (M) - (M) ** Permission
Permission ** (1) - (M) ** Domain
There is a generic repository. I get from the context a collection of users as follows:
List<User> AllUsers = context.GetAllIncluding<User>(u=>u.Permissions).ToList(); I get a collection of users, each element of which includes the corresponding collection of instances of the Permission class, and now in these instances the link to the collection of instances of the Domain class contains null.
Question: How to get a collection of users, each element of which will contain the Permissions collection, each element of which, in turn, will contain the Domains collection, etc.