The LINQ expression node type 'Lambda' is not supported in LINQ to Entities
c#, entity-framework, linq
Solution
Use this:
var result = context.Corrects.Where(predicate);
instead of this:
var result = context.Corrects.Where(x => predicate == null);
`Where` expects argument of type `Expression<Func<T, bool>>`, but you're trying to pass `Expression<Func<T, Expression<...>>` instead. This is valid compile-time construct, but at run-time LINQ provider fails, when it tries to translate `predicate` to SQL.
Also note, that you should change `Expression<Func<Correct, bool?>>` into `Expression<Func<Correct, bool>>`.
Problem
I'm trying use Expression and pass to query. But I have error - The LINQ expression node type 'Lambda' is not supported in LINQ to Entities. I'm also used linqkit.dll with AsExpandable(), but but have the same error. ``` public List<Correct> GetCorrects(Expression<Func<Correct, bool?>> predicate) { using (SystemsEntities context = new SystemsEntities()) { var result = context.Corrects.Where(x => predicate == null); return result.ToList(); } } ``` I get the error stated above. What is failing?