Use this:
var result = context.Corrects.Where(predicate);
instead of this:
var result = context.Corrects.Where(x => predicate == null);
Where expects an argument of type Expression<Func<T, bool>> , but instead you are trying to pass Expression<Func<T, Expression<...>> . This is a valid compile time construct, but the LINQ provider fails when it tries to translate predicate into SQL.
Also note that you must change Expression<Func<Correct, bool?>> to Expression<Func<Correct, bool>> .
Dennis
source share