我试图在EF查询中进行左连接。我收到以下错误:
错误CS1941 join子句中的一个表达式的类型是 不正确。调用' GroupJoin'
时,类型推断失败
这是C#代码:
var foo = from m in db.ClientMasters
join a in db.Orders on new { m.Id, Status = "N" } equals new { a.ClientID, a.Status } into a_join
from a in a_join.DefaultIfEmpty()
select new { m.ClientID, a.ID };
答案 0 :(得分:3)
var foo = from m in db.ClientMasters
join a in db.Orders on new { ClientID = m.Id, Status = "N" } equals new { a.ClientID, a.Status } into a_join
from a in a_join.DefaultIfEmpty()
select new { ClientID = m.Id, OrderId = a.Id };