David Thielen
David Thielen

Reputation: 32926

.net wrapper for OData to access any data source

I am looking for an OData wrapper in C# that can talk to any OData datasource and return the result as properties instead of the raw XML. I looked at http://odata.codeplex.com/ but it is designed around the concept of pointing to a specific datasource and building code that maps to it.

We need to create code where at runtime we are pointed to an OData datasource and read the metadata and then interactively call it with queries and then use the returned data. (I also believe Linq won't work for us because we have end users creating queries once we connect - no writing code and compiling.)

Is there anything out there?

thanks - dave

Upvotes: 0

Views: 3917

Answers (2)

SCB
SCB

Reputation: 3084

You might have to write a custom provider for what you are trying to achieve.

The following blog series are pretty helpful:

http://blogs.msdn.com/b/alexj/archive/2010/01/07/data-service-providers-getting-started.aspx

http://blogs.msdn.com/b/vitek/archive/2010/02/25/data-services-expressions-part-1-intro.aspx

Upvotes: 2

Vitek Karas MSFT
Vitek Karas MSFT

Reputation: 13320

I assume you want to consume arbitrary OData service as a client, right? For that I would suggest using ODataLib (http://www.nuget.org/packages/Microsoft.Data.OData). It is a reader and writer for OData, nothing more. So it will require more code from you as compared to the WCF Data Services, but it allows consuming arbitrary OData payloads without the necessity to generate the matching types. You might also want to check out this blog for the start: http://blogs.msdn.com/b/astoriateam/archive/2011/10/14/introducing-the-odata-library.aspx

Upvotes: 2

Related Questions