Is there a general method to check whether a property define supported by a Linq provider, especially OData?

后端 未结 2 1329
暖寄归人
暖寄归人 2021-02-20 05:09

I successfully ran the following statement with the NorthWind.sdf in LinqPad:

from s in Shippers
    select new
{
    s.ShipperID,
    s.CompanyName,      
    C         


        
2条回答
  •  猫巷女王i
    2021-02-20 05:32

    Unfortunately the only way to find out is by testing a specific query or via documentation if the creator of the LINQ provider has provided a detailed list of what is not supported.

    LINQ itself has a very loose specification largely defined by the extension methods defined on IQueryable/IEnumerable. Implementing a LINQ provider means you have to implement a translation over the data source - e.g. LINQ to SQL translates the expression tree expressed in a LINQ query into SQL which is understood by a database provider. Each data source has its own limitations which will ultimately govern what can be supported, and likewise each LINQ provider can choose to implement (or not implement) any particular method or behavior.

    It may be the case that this is just a limitation of the provider inside LINQPad for dealing with OData - you might want to check out OQuery instead and see if that provides a better set of capabilities for you - have a look at http://beta.code.msdn.microsoft.com/OQuery-Building-OData-d2e75eed for the details and a download.

提交回复
热议问题