C# 如何将外部排除连接查询转换为LINQ

C# 如何将外部排除连接查询转换为LINQ,c#,sql,linq,C#,Sql,Linq,我想将此sql查询转换为linq: SELECT Number FROM Pager FULL OUTER JOIN Location ON Pager.PagerId = Location.PagerId FULL OUTER JOIN PersonCalls ON Pager.PagerId = PersonCalls.PagerId FULL OUTER JOIN Activity ON Pager.PagerId = Activity.PagerId WHERE (Pager.Page

我想将此sql查询转换为linq:

SELECT Number
FROM Pager 
FULL OUTER JOIN Location
ON Pager.PagerId = Location.PagerId
FULL OUTER JOIN PersonCalls
ON Pager.PagerId = PersonCalls.PagerId
FULL OUTER JOIN Activity
ON Pager.PagerId = Activity.PagerId
WHERE (Pager.PagerId IS NULL OR Location.PagerId IS NULL) AND
(Pager.PagerId IS NULL OR PersonCalls.PagerId IS NULL) AND
(Pager.PagerId IS NULL OR Activity.PagerId IS NULL)
这是正确的。 但对于linq,我测试了以下代码:

var query = from Activity in db.Activity
 from Location in db.Location
from PersonCalls in db.PersonCalls
where
(Activity.Pager.PagerId == null ||
Location.PagerId == null) &&
 (Activity.Pager.PagerId == null ||
PersonCalls.PagerId == null) &&
(Activity.Pager.PagerId == null ||
Activity.PagerId == null)
select new {
 Activity.Pager.Number
}

那对我没有结果

LINQ不提供完全联接。它只合并现有的元素。因此,在linq表达式中,所有现有活动都与所有现有位置相结合,并且这些组合与所有现有调用相结合。顺便说一句:您没有匹配该表达式中的
PagerId
s。左外部联接与左联接相同这可能会有所帮助: