ADO.NET Data Services is the data provider for Silverlight-based applications. You can use ADO.NET Data Services to display and update data from a remote data source in a Silverlight-based application. ADO.NET Data Services exposes data based on an entity and relationship model that enables you to access data in the style of representational state transfer (REST) resources. Silverlight-based applications can access the data through the standard HTTP protocol to execute queries and to create, update, and delete data on the server.
The ADO.NET Data Services client library for Silverlight generates HTTP requests to the data service and translates the data in the response messages into objects on the client. The two main classes of the client library are the DataServiceContext class and the DataServiceQuery<(Of <(TElement>)>) class. The DataServiceContext class encapsulates operations that are supported against a specified data service. Although data services are stateless, the context is not. Therefore, you can use the DataServiceContext class to maintain state on the client between interactions with the data service in order to support features such as change management. This class also manages identities and tracks changes. The DataServiceQuery<(Of <(TElement>)>) class represents a query against a specific entity set. The ADO.NET Data Services client library for Silverlight only supports asynchronous operations. For more information, see ADO.NET Data Services.
Topics in this section form a walkthrough, and each topic builds on the previous one. At the end of each topic, you will have a functional application. The complete sample application can be downloaded from the MSDN Code Gallery Web site.
The first task shows how to create a data service that is based on the Northwind sample database by using ADO.NET Data Services. In subsequent tasks, you will define the Silverlight-based application; create and execute queries against the data service that return entity data as objects; bind entity data to controls; and insert, update, and delete data by using the data service.
Note: |
|---|
All operations against a data service from a Silverlight-based application are executed asynchronously. |
This walkthrough is intended for users who are familiar with developing applications for Silverlight by using Visual Studio, but who are new to ADO.NET Data Services. To complete the walkthrough, you must have the following installed:
Silverlight version 2 or later versions.
Silverlight Tools for Visual Studio 2008 or later versions.
Visual Studio 2008 SP1 or later versions.
Microsoft SQL Server 2005 or later versions with Database Services, or the Express edition of SQL Server 2005 or later versions.
Northwind sample database, which is available from this Microsoft Web site.
Note: |
|---|
The Northwind database is compatible with SQL Server 2000 and later versions. |
For more information, see Silverlight Tools.
ADO.NET Data Services Tasks
- Creating the Northwind Data Service
Create a data service that is based on the Northwind database that can be used by applications for Silverlight.
- Creating the Client Application
Create the application and generate client libraries that are based on the Northwind data service by using the Add Service Reference tool.
- Querying the Data Service
Query the Northwind data service for Customers and Orders and bind query results to controls.
- Loading Related Entities
Load Order_Details objects that are related to select Orders objects.
- Modifying and Deleting Entity Data
Change or delete select Order_Details entities by using the data service.
- Creating New Entities with Relationships
Create new Order_Details objects that are related to an Order object and persist them as new entities and relationships in the data service.
Create the Northwind data service
Other Resources