With PredicateBuilder how do I get functionality similar to the SQL IN or NOT IN query?
For example I have a list of IDs and I want to select all of the People whose IDs either Match or do not match the IDs.
The people match functionality is fairly straightforward (although there may be a better way to do it)
var predicate = PredicateBuilder.False<Person>()
foreach (int i in personIDs)
{
int temp = i;
predicate = predicate.Or(e=>e.PersonID == temp);
}
return persons.Where(predicate);
So how do I get the opposite? I want all persons whose IDs are not in the personIDs list.