Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Eager Loading - More Examples
var posts = context.Posts
.Include(p => p.Author.JobTitle) //We are going two levels deep
//We are going two levels deep here, also. However, since Authors.Posts is a collection, we
//need to do a little LINQ-Fu to properly include Categories.
var author = context.Authors
.Include(a => a.Posts.Select(p => p.Category))
.Single(a => a.ID == id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.