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 ...
Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.