EF LINQ include nested entities [duplicate]
问题 This question already has an answer here : Tree stucture table and entity framework (1 answer) Closed 3 years ago . I have multi-leveled entities with the following hierarchy: Parent-> RootChildren -> Children -> Children -> ..... Class Parent { public int Id {get; set;} public virtual Child RootChildren {get; set;} } Class Child { public virtual List<Child> Children {get; set;} } Now, I want to include entity which include all the child as nested way. I tried the following but it didn't work