I have a query like:
var function = GetSomeExpression();
using (FooModel context = new FooModel())
{
var bar = context.Bar.Where(function);
}
This is way easier then what I was trying before:
private List<T> GetResults<T>(IQueryable<T> source,
Expression<Func<T, bool>> queryFunction)
{
return source.Where(queryFunction).ToList<T>();
}
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.