O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using an OData Proxy

To query an OData producer, such as the eBay OData service, first create an instance of the generated OData model class, using the service root URI, like so:

EBayData ebayData = new EBayData(new Uri("http://ebayodata.cloudapp.net/"));

We then create a DataServiceCollection, which is used to query the OData service asynchronously and to populate itself with the objects representing items in the response feed. The DataServiceCollection type inherits from ObservableCollection, which means it supports INotifyCollectionChanged out of the box, and it can be used directly within the user interface.

To instantiate a DataServiceCollection, an OData model instance is passed to its constructor, like so:

searchResult = new DataServiceCollection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required