Ok, I have tri-leveled entities with the following hierarchy: Course -> Module -> Chapter
Here was the original EF LINQ statement:
Course course = db.Courses .Include(i => i.Modules.Select(s => s.Chapters)) .Single(x => x.Id == id); Now, I want to include another entity called Lab which is associated with a course.
How do I include the Lab entity?
I tried the following but it didn't work:
Course course = db.Courses .Include(i => i.Modules.Select(s => s.Chapters) && i.Lab) .Single(x => x.Id == id); Any ideas on including the 2nd Entity?
Any piece of advise or information would be highly appreciated. Thanks!
.Includeshould work unless you mean that the additional include is a grandchild of Course. See this or a better option is this.Include(t => t.Prop).ThenInclude(p => p.NestedProp)