I am using Entity Framework code first and I have code like this:
var foos = context.Foos.Where(f => f.Bar == "Hello World").ToList();
Using an SQL profiler, I see that the script run against the database contained a WHERE statement, as expected.
But when I put the Where predicate in a variable:
Func<Foo, bool> predicate = f => f.Bar == "Hello World");
var foos = context.Foos.Where(predicate).ToList();
the resulting SQL command no longer contains a WHERE statement.
Is there a way that this can work?
WHERE?