【发布时间】:2009-09-19 15:08:36
【问题描述】:
我有一个 Departments 表,该表在 Department.SiteId = Sites.SiteId 上有一个指向 Sites 的外键列。现在在我的 EF 模型中,我的 Departments 实体没有 Siteid 属性,只是对 Sites 的引用。如何在 LINQ 查询中选择具有特定 SiteId 的所有部门?
【问题讨论】:
标签: .net linq entity-framework
我有一个 Departments 表,该表在 Department.SiteId = Sites.SiteId 上有一个指向 Sites 的外键列。现在在我的 EF 模型中,我的 Departments 实体没有 Siteid 属性,只是对 Sites 的引用。如何在 LINQ 查询中选择具有特定 SiteId 的所有部门?
【问题讨论】:
标签: .net linq entity-framework
var query =
from d in entities.Departments
where d.Site.SiteId == theSiteId
select d;
【讨论】: