Using Data Services with a Data Context

In the previous section, we built a sample application that displays the kill log from a fictional video game called Zombie Killa. This kill log is exposed as a WCF Data Service, and we communicated with that service through an automatically generated proxy class.

In this section, we take a look at how we can talk to the WCF Data Service without using any generated code or classes by using the DataServiceContext class directly.

As with the generated proxy, we create an instance of the proxy by providing it with the URL of the WCF Data Service. After that, we can create our own queries (and make changes, inserts, and deletes) by invoking various methods on the context. In the code in Listing 21.4, we call ...

Get ASP.NET 4 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.