Change filterProgram to Expression<Func<Program, bool>> and then it should be used in the LINQ Where clause.
However, one caveat: I managed to get it to work in the method chain syntax, but not in the query syntax.
For example, this works:
dataContext.Programs.Where (filterProgram)
but this is not so:
from p in dataContext.Programs where filterprogram
(The compiler complains that it cannot solve the Where method, which is available for both IEnumerable and IQueryable .)
In your case, it may be acceptable to replace the string
join p in repository.Query<Program>()
from
join p in repository.Query<Program>().Where(filterProgram)
Golfwolf
source share