LINQ to Entities 和子查询
我尝试将数据模型移动到 OData。我尝试了很长时间来寻找嵌套查询的解决方案。
我们需要在给定的项目中缺勤。
我们的数据库模式+实体模式是:
缺席 - 所有项目中所有用户缺席。
项目 - 项目列表
TeamMember - 与项目表相关的团队成员故事。如果有缺勤记录,此处的 UserID 应与缺勤中的用户 ID 相同。
SQL QUERY:
SELECT [Id], [UserId], [Date] FROM [Absence] WHERE UserId IN (SELECT UserId FROM TeamMember WHERE ProjectId={0})
我们面临的问题是编写类似的 LINQ to Entities 查询
任何愿意提供帮助的人?
先感谢您!
I try to move data model to OData. Itry to find a solution for nested query for quite long time.
We need to get absences in given project.
Our database schema + entities schema is:
Absences - absences of ALL user in ALL projects.
Project - list of projects
TeamMember - team members tale with relation to Project table. UserID here should be the same as in Absence in case of absence record.
SQL QUERY:
SELECT [Id], [UserId], [Date] FROM [Absence] WHERE UserId IN (SELECT UserId FROM TeamMember WHERE ProjectId={0})
The problem for us is to write similar LINQ to Entities query
Anyone willing to help?
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是你想要实现的目标吗?
is this what you are trying to accomplish?