How do you filter the nested includes in an EF Linq query? For example if I have:
var blogs = context.Blogs
.Include(blog => blog.Posts)
.ThenInclude(post => post.Author)
.ThenInclude(author => author.Photo)
.ToList();
But I only want to get Blogs with Posts after a certain date, or Authors by the name 'Mark'.
I would like to be able to do the following in some way:
var blogs = context.Blogs
.Include(blog => blog.Posts).Where(... blog.Posts.Date>X.... )
.ThenInclude(post => post.Author).Where(... post.Author.Name=='Mark' ...)
.ThenInclude(author => author.Photo)
.ToList();
Or am I missing something really simple here? Thanks for your advice in advance!