KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I successfully ran the following statement with the NorthWind.sdf in LinqPad: from s in Shippers select new { s.ShipperID, s.CompanyName, Count=s.ShipViaOrders.Count() } At the same time , I failed to run a similar statement with the Odata Service ( http://services.odata.org/northwind/northwind.svc ) in LinqPad: from s in Shippers select new { s.ShipperID, s.CompanyName, Count=s.Orders.Count() } The error is "Constructing or initializing instances of the type <>f__AnonymousType0`3[System.Int32,System.String,System.Int32] with the expression s.Orders.Count() is not supported.". I know OData service is very limited in Linq Support. I have dynamic Linq statement support in my application. Actually I am trying to migrate the datasource from Compact SQL Server to OData service. So I have to deal with NotSupportedException in a general way. At present, I try to check the syntax of property define before running it, such as "s.Orders.Count() as Count" It passed my check, but it met NotSupportedException of OData. Is there a way to check whether a property define (by a string or lambda) is supported by a Linq provider? Any suggestions are appreciated. Ying
Tags (comma-separated)
Save Edits
Cancel