Linq To Entities加入问题

时间:2014-04-06 01:03:47

标签: c# linq linq-to-entities

你如何与Linq to Entities进行这样的联接?

var resultA = client.GetFirstList().ToList();                   
var resultB = client.GetSecondList().ToList();

var d = (from b in resultB
         join a in resultA on b.AnICollection.Select(x => x.TypeId) equals a.TypeId 
select b)

1 个答案:

答案 0 :(得分:1)

您应该可以像下面这样查询它:

from a in context.Customers
join b in context.Orders
on a.CustomerID equals b.CustomerID
join c in context.AnICollection
on b.TypeID equals c.TypeID
select b