Linq is not converting to SQL properly on runtime [duplicate]

It’s probably due to the fact that you’re calling the function using two local variables as parameters so it’s evaluating client side before querying the database, resulting in the error.