Creating an OData Wrapper

The previous section looked at querying an OData service using the OData model class. Although accessing the OData service model classes directly from a viewmodel is possible, it can make unit testing difficult because it relies on the actual OData producer.

In the sample for this chapter, an intermediary class called EbayClient performs all OData queries. EbayClient implements the custom IEbayClient interface, shown in the following excerpt:

public interface IEbayClient{    void SearchItemsAsync(string query,                          int beginIndex = 0, int maxItems = 0);    event EventHandler<SearchItemsCompleteEventArgs> SearchItemsComplete;}

By using the IEbayClient interface and not ...

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.