简体   繁体   中英

How to use Entity Framework include with condition?

Suppose that we have two entities, Posts and Comments . Posts has a navigation property to Comments and vice versa:

public virtual ICollection<Comment> Comments { get; set; }

And also Comments has a navigation property to User :

public virtual User User { get; set; }

Now, how to query all Posts including only the last comment (by comment creation date) and the user who created it?

当前版本的EF无法实现,但是您可以在此处投票https://entityframework.codeplex.com/workitem/47

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM