我正在尝试加入多种条件。问题在于它是'等于'和'不等于'的混合体。此previous answer仅在您想加入'等于'时才有效。
from p1 in context.Set<PersonList>()
join p2 in context.Set<PersonList>()
on p1.Email equals p2.Email && p1.PersonID != p2.PersonID
答案 0 :(得分:0)
只需使用where
来捕获额外条件:
from p1 in context.Set<PersonList>()
join p2 in context.Set<PersonList>()
on p1.Email equals p2.Email into p2j
from p2 in p2j.DefaultIfEmpty()
where p2 != null && p1.PersonID != p2.PersonID