How can I call local method in Linq to Entities query?
问题 I have the following code: public void SalesCount(string customerId) { .. .. return ...; } var resultQuery = dataContext.Customers .Where (c => c.Name == "Alugili") .Where (c => SalesCount(c.CustomerId) < 100); When I execute resultQuery I get a translation to SQL exception. I need to call SalesCount in the Where can I do that is there any workaround for this problem! 回答1: Simply you can't. You can't execute C# code on the SQL server directly, you can use only Expressions and some special