【问题标题】:How do I work with a join table in LINQ?如何在 LINQ 中使用连接表?
【发布时间】:2016-04-15 09:59:33
【问题描述】:

在我的 LINQ 中为多对多连接表而苦苦挣扎:-(

我有 College、Student 和 StudentApplications 实体。

A College has many StudentApplications

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

我怎样才能最好地获得所有已申请大学的学生?

我更喜欢使用 Lambda 表达式。

或者,如果您能指出一个很好的在线教程,可以帮助我自己更好地解决问题!

EF Core 错误

在根据答案实施时(谢谢),我在该区域的 EF 7/Core 中遇到了一个错误。我提出了以下问题:

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

【问题讨论】:

    标签: c# .net linq join lambda


    【解决方案1】:
    students.Where(s => s.Applications.Any(a => a.College == searchCollege));
    

    【讨论】:

      猜你喜欢
      • 2011-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-30
      • 1970-01-01
      • 2012-12-30
      相关资源
      最近更新 更多