O'Reilly logo

Data-Driven Services with Silverlight 2 by John Papa

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

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 ...

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