【发布时间】:2014-01-10 14:47:57
【问题描述】:
我在 ASP.NET Web 应用程序中使用实体框架我已经形成了一个 linq 查询,以使用基于查询的语法获取该位置的员工的报价列表。查询如下。
主 Linq 查询
using (var emp = new EmployeeEntities())
{
return
(
from p in emp.Employees
join pl in emp.EmployeeLocations on p.Id equals pl.EmployeeId
join l in emp.OfferLocations on pl.Id equals l.EmployeeLocationId
join po in emp.EmployeeOffers on l.EmployeeOfferId equals po.Id
where p.Id == employeeId && po.ParentId == SpecialGroupId && po.Id == offerid
select po
).ToList().AsReadOnly();
}
我想知道如何通过使用来形成基于方法的语法
在哪里
和
包括
像下面的例子
Linq 查询示例
return emp.EmployeeLocations.Include("OfferLocations.EmployeeOffer.Category").Include("Employee").Where(pl => pl.Id == locationId).ToList<EmployeeLocation>();
谁能帮我形成基于方法的查询。谢谢
【问题讨论】:
-
你可以
accept回答否?
标签: asp.net linq entity-framework