LINQ to Entities does not recognize the method ‘Int64 getCount()’ method, and this method cannot be translated into a store expression.
return query.OrderBy(e => e.Person.getCount(), sortDirection);
how can I rewrite this line ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Please use:
The case is EF tries to convert
getCount()method to SQL. As it’s custom method it can’t be done so you should callToList()to evaluate the expression and to make EF load objects from database to memory. Then linq can call you custom function to sort the data.