How to create SQL Nested ANDs inside of multiple ORs using LINQ
问题 I'm trying to create the equivelant LINQ query from the below SQL example: SELECT * FROM FOO WHERE ((a == <val1>) AND (b == <val2>) AND (c == <val3>)) OR ((a == <val4>) AND (b == <val5>) AND (c == <val6>)) There will always be an a, b, and c that will be AND'd together surrounded by an OR. This pattern can occur n amount of times. The only solution I have found that work is using LINQ Union but the SQL generated isn't what I would like. 回答1: Try implementing the PredicateBuilder class. Then