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

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -