This question pertains to query optimization using Linq with the Entity Framework.
Is there any difference between chaining .Where
clauses and using &&
in a single .Where
clause of a linq query with the entity framwork?
E.g.: suppose I have the following code:
var result = context.SomeEntity.Where(exp1).Where(exp2);
or
var result = context.SomeEntity.Where(exp1 && exp2);
When evaluating these statements, which yield the same result, does the linq and the entity framework evaluate them in the same way? i.e., will both have the same execution plan, and therefore be equally efficient?