https://msdn.microsoft.com/en-us/data/jj574232.aspx
var blogs1 = context.Blogs
.Include(b => b.Posts.Select(p => p.Comments))
.ToList();
陈福来 2015/8/14 17:21:11
// Load all blogs, all related posts, and all related comments
var blogs1 = context.Blogs
.Include(b => b.Posts.Select(p => p.Comments))
.ToList();
// Load all users their related profiles, and related avatar
var users1 = context.Users
.Include(u => u.Profile.Avatar)
.ToList();
// Load all blogs, all related posts, and all related comments
// using a string to specify the relationships
var blogs2 = context.Blogs
.Include("Posts.Comments")
.ToList();
// Load all users their related profiles, and related avatar
// using a string to specify the relationships
var users2 = context.Users
.Include("Profile.Avatar")
.ToList();
returnValue=context.Assessments.Where(item=>item.State== AssessmentType.Used).Include(item=>item.QuestionList.Select(p=>p.Options)).ToList();
ef导航属性
原文:http://www.cnblogs.com/wcLT/p/4730691.html