我正在开发一个 ASP.NET MVC 应用程序。我有两个查询我想从这些查询中获取公共记录。
我想写简单的连接来获取公共记录吗?
var poList =
(from po in db.PurchaseOrders
where po.CompanyId == companyId &&
po.PartyId == partyId &&
(po.IsDeleted == false || po.IsDeleted == null)
select po into newPO
select new
{
Name = newPO.PONo,
Id = newPO.Id
});
var poList2 = (db.Employees.Where(x => x.Id == EmpID)
.SelectMany(x => x.Roles)
.SelectMany(x => x.Employees)
.Distinct()
.SelectMany(x => x.PurchaseOrders)
.Select(po => new { Name = po.PONo, Id = po.Id }));
我正在尝试编写联接,但它要求再提出一个论点,如何为公共记录编写简单的联接?
var finalPO = poList.Join(poList2).ToList();