0

I'm trying to join on multiple conditions. The problem is that it is a mix of 'equals' and 'not equals'. This previous answer only works if you want to join on 'equals'.

from p1 in context.Set<PersonList>()
join p2 in context.Set<PersonList>()
on p1.Email equals p2.Email && p1.PersonID != p2.PersonID
Wouter
  • 154
  • 17

1 Answers1

0

Just use where to capture the extra conditions:

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
NetMage
  • 26,163
  • 3
  • 34
  • 55