I have the following code:
public void SalesCount(string customerId)
{
..
..
return ...;
}
var resultQuery = dataContext.Customers
.Where (c => c.N
Simply you can't. You can't execute C# code on the SQL server directly, you can use only Expressions and some special recognized functions...
Unless you transform your query (at least partially) in a LINQ-to-Objects...
var resultQuery = dataContext.Customers
.Where (c => c.Name == "Alugili")
.AsEnumerable()
.Where (c => SalesCount(c.CustomerId) < 100);
Be aware that the last Where will be executed on the client side, so many useless rows will be fetched from the DB.