Entity Framework - Include Multiple Levels of Properties
If I understand you correctly you are asking about including nested properties. If so :
.Include(x => x.ApplicationsWithOverrideGroup.NestedProp)
or
.Include("ApplicationsWithOverrideGroup.NestedProp")
or
.Include($"{nameof(ApplicationsWithOverrideGroup)}.{nameof(NestedProp)}")
EF Core: Using "ThenInclude" to load mutiple levels: For example:
var blogs = context.Blogs
.Include(blog => blog.Posts)
.ThenInclude(post => post.Author)
.ThenInclude(author => author.Photo)
.ToList();
For EF 6
using System.Data.Entity;
query.Include(x => x.Collection.Select(y => y.Property))
Make sure to add using System.Data.Entity;
to get the version of Include
that takes in a lambda.
For EF Core
Use the new method ThenInclude
using Microsoft.EntityFrameworkCore;
query.Include(x => x.Collection)
.ThenInclude(x => x.Property);