I have a query like:
var function = GetSomeExpression(); using (FooModel context = new FooModel()) { var bar = context.Bar.Where(function); }
see this post
LINQ to entities - Building where clauses to test collections within a many to many relationship
Edit: after your post update this doesn't seem relevant anymore; I'll leave it in case it's helpful.