The lambda expression that you write inside Where is actually evaluated and translated into SQL using EF. For example, when you write
db.Pages.Where(x => x.Title == "Hello")
EF knows how to convert the resulting IQueryable<T> to something like:
SELECT ... FROM Pages WHERE title = 'Hello'
Similarly, he knows about some common methods and operators, for example:
db.Pages.Where(x => x.Contains("Hello"))
EF knows to translate String.Contains to:
SELECT ... FROM Pages WHERE title LIKE '%Hello%'
However, when you use your own methods with an expression, EF does not know how to translate this custom method into SQL, which it complains about in the error message you saw.
source share