c# - Chaining multiple Linq Where calls as an OR, not an AND -
i have filtering code refactoring presently has large number of if blocks determine way apply filter.
it looks @ various options filters , builds 1 big linq (to ef) statement everything.
when chain multiple linq .where
calls, resultant operation and. how do or when chaining multiple .where
calls.
for example
users = users.where(l => l.location == "mylocation") users = users.where(r => r.role == "role")
the result same as
users = users.where(u => u.location == "mylocation" && u.role == "role")
where want
users = users.where(u => u.location == "mylocation" || u.role == "role")
thanks.
you're looking predicatebuilder, can construct expression trees logical operators.
Comments
Post a Comment