Services over Custom Data Sources

You can create an ADO.NET Data Service that exposes query access to data where a provider with an IQueryable implementation exists over the data. If the provider also has an IUpdatable implementation, ADO.NET Data Services supports making modifications to the model, too. If you are looking to expose data from a relational database, the Entity Framework is tightly integrated with ADO.NET Data Services out of the box, allowing you to expose data from SQL Server and other third-party relational databases. As ADO.NET Data Services grows in popularity it is reasonable to think that other entity modeling tools will follow suit and will offer IQueryable and IUpdatable implementations. In the meantime, you can expose custom objects manually so that they can be consumed, in this case by Silverlight 2 applications through the ADO.NET Data Services Silverlight client library.

Using ADO.NET Data Services over a custom entity model requires that you have a custom entity model and that you then complete the following basic steps:

  1. Create a custom data source.

  2. Create a class that represents the model of the data for the services (a data context class).

  3. Implement IQueryable and/or IUpdatable for the data model class.

  4. Reference System.Data.Services.dll.

  5. Create a service with ADO.NET Data Services.

  6. Derive the service from DataService<CustomContextGoesHere>.

The CustomDataService.Web example project for this chapter contains a web application project with an ADO.NET Data Services ...

Get Data-Driven Services with Silverlight 2 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.