I’m looking at this Telerik demo, and am unable to get the “count” statement to work. I believe that the following command is only supported on EntityFramework, and not Linq2SQL.
return CurrentDataSource.Products.Where(where).Count();
The parameter “where” in lowercase is actually a string that is passed in the ADO.Net DataServices (OData) url. This URL should be sent to the Linq provider to further constrain the query.
If that is not supported in Linq2SQL, how can I make a similar statement?
You need to use a lambda expression for the predicate used by the
Queryable.Wheremethod:If you really want to use a string then take a look at Dynamic LINQ, starting with Scott Gu’s blog post: Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library). Then you should be able to write queries similar to: