Sunday, February 6, 2011

Entity Framework & Include

Programmer Question

Hi, All
Please help me make include() work in the following case:



ctx.Messages
.Include("Comments.CommentType")
.Include("Comments.Owner")
.Include("Comments.Message")
.Where(m => m.RID == messageId)
.SelectMany(m => m.Comments)
.Where(c => c.CommentType.Id == commentTypeId)
.ToList();


How I should rewrite this query?



P.S. I'm using EF 3.5 (not 4.0)



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails