Reputation: 15938
I'm have a query with some "OR" operators. for instance.
entities.Where(e=> (...) || (...) || (...) || (...));
I would like to break this into several calls like the Where()
function allows me. for instance:
entities = entities.Where(e => (some logic A));
// ...
entities = entities.Where(e => (some logic B));
// ...
entities = entities.Where(e => (some logic C));
Is possible to do the same but for a OR
logic instead of AND
Logic?
The main reason that I would like to break this logic into several lines of code is that each OR
can be applied by different functions.
Upvotes: 0
Views: 83
Reputation: 110171
you can do something like:
set1 = entities.Where(e => (some logic A));
set2 = entities.Where(e => (some logic B));
set3 = entities.Where(e => (some logic C));
entities = set1.Union(set2).Union(set3);
Upvotes: 2