orderby 嵌套 linq
var query = from m in db.Members.Include("Companies.Projects.Experiences.ExperienceTags")
where m.MemberId == id
select m;
我也想从这个查询到 orderby the project.enddate。我该怎么做呢。 enddate 也可以为 null,然后我希望它是 orderby 时的今天日期。而且,公司可能并不总是有一个项目,那么它也应该在今天之前订购。
这是 ef 数据图的图像链接
var query = from m in db.Members.Include("Companies.Projects.Experiences.ExperienceTags")
where m.MemberId == id
select m;
I would like to also from this query to orderby the project.enddate. How would I do that. Also enddate can be null which then I would like it to be today date when it orderby. And, a company might not always have a project either which then it should be orderby today date too.
here is a image of the ef data diagram a link
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于存在多种关系,您需要像这样执行 SelectMany:
Since there is a many relationship you need to do a SelectMany like so: