简体   繁体   English

如何在LINQ中使用联接表?

[英]How do I work with a join table in LINQ?

Struggling with my LINQ for a many to many join table :-( 与我的LINQ进行多对多连接表挣扎:-(

I have College, Student and StudentApplications entities. 我有College,Student和StudentApplications实体。

A College has many StudentApplications

A Student has many StudentApplications (for a number of different Colleges)

How do I best get all the Students that have applied to a College? 如何最好地让所有已申请大学的学生?

I'd prefer to use Lambda expressions. 我更喜欢使用Lambda表达式。

Or if you can point to a good online tutorial that could help me work it out myself even better! 或者,如果您可以指向一个好的在线教程,可以帮助我自己做得更好!

EF Core BUG EF核心错误

While implementing based on the answer (thanks for that) I came across a bug in EF 7/Core in this area. 在基于答案实施(感谢)的过程中,我遇到了EF 7 / Core在此方面的错误。 I raised the following issue: 我提出了以下问题:

https://github.com/aspnet/EntityFramework/issues/5084 https://github.com/aspnet/EntityFramework/issues/5084

students.Where(s => s.Applications.Any(a => a.College == searchCollege));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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