I'm trying to build a portable class library targeting .NET, Silverlight, Windows RT and Windows Phone that acts as an OData client. I'm using Visual Studio 2012.
When I created the service reference to my OData server side, I got the following error message:
Unable to add a service reference to the specified OData feed because WCF Data Services is not installed for this target framework. To install a supported version of WCF Data Services, see http://go.microsoft.com/fwlink/?LinkId=253653.
When I go to the URL listed in the error message, I can choose between a library for Windows RT and one for Windows Phone, so this does not seem to work for a portable class library.
Is there any secret workaround to this, or do I have to code my own Odata client with bare HTTP requests?
Also, if I do have to use bare HTTP Requests, is there at least some kind of API I can build on for json or xml serialization / deserialization that works inside a portable class libarary?
Thanks,
Adrian
The OData Client library allows you to consume data from and interact with OData services from . Net apps. There are multiple layers of abstraction available when working with the library: You can use the library directly to interact with any service.
Once installed, right-click your project in the Solution Explorer -> Add -> Connected Service. In the Connected Services window that appears, select OData Connected Service. Next, OData Connected Service provides us a wizard where we can configure settings for the service we want to connect to.
Actually I have a portable class library for OData (Simple.OData.Client) but didn't make a NuGet package for it yet. It's a part of Simple.Data OData adapter.
I am using Simple.OData.Client PCL in the app that I plan to port to various platform including iOS and Android (using Xamarin). If you are interested to give it a try I propose one of two alternatives:
a) Clone the Simple.Data.OData repo (https://github.com/simplefx/Simple.OData), switch to "winrt" branch, build it, there you have Simple.OData.Client that is a PCL supporting most of the platforms. Wiki currently describes Simple.Data adapter syntax, so you need to check Simple.OData.Client tests (https://github.com/simplefx/Simple.OData/tree/master/Simple.OData.Client.Tests) to understand the syntax. It has supports two syntax flavors: when you format filter string yourself and when you use its fluent API. Both of them are very straightforward to use.
b) I can speed up work on a NuGet package for a PCL (currently uploaded NuGet package only supports NET4), but it will take longer time.
Let me know if you are interested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With