I\'ve got a scenario where I need to build a SQL query, using LINQ, that includes a variable amount of OR clauses. I\'m writing a function that will build the query based on
You can use the PredicateBuilder to chain or conditions.
or
var predicate = PredicateBuilder.False<SomeEntity>(); predicate = predicate.Or (p => p.A == true); if(something) predicate = predicate.Or (p => p.B == true); var query = entities.AsExpandable().Where (predicate); //AsExpandable() for EF