次の方法で共有


ADO.NET Data Services Overview

ADO.NET Data Services consists of patterns and libraries that enable the creation and consumption of data services for the Web or an intranet. ADO.NET Data Services exposes data as resources that are addressable by URIs. This enables you to access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. This topic provides an overview of the components, patterns, and practices that compose ADO.NET Data Services.

Address Data as Resources

ADO.NET Data Services exposes data as resources that are addressable by URIs. These resources are represented in terms of the entity-relationship conventions of the Entity Data Model (EDM). In this model, entities represent operational units of data in an application domain, such as customers, orders, items, and products.

In ADO.NET Data Services, you address entity resources as an entity set that contains instances of entity types. For example, the following URI from the quickstart returns all of the orders from the Northwind data service that are related to the customer with a CustomerID value of ALFKI:

https://localhost:12345/Northwind.svc/Customers('ALFKI')/Orders

Note

When developing a data service with Visual Studio, the host name of your data service is typically in the format of localhost:<port number>. After the service is deployed, the host name will be the URI of the server that is hosting the data service.

Query expressions enable you to perform traditional query operations against resources, such as filtering, sorting, and paging. For example, the URI https://localhost:12345/Northwind.svc/Customers('ALFKI')/Orders?$filter=Freight gt 200 filters the resources to return only the orders with a freight cost of more than $200. For more information, see Accessing Data Service Resources (ADO.NET Data Services).

Interoperable Data Access

ADO.NET Data Services takes advantage of standard Internet protocols to create data services that interoperate with applications that do not use the .NET Framework. Because you can use standard URIs to address data, your application can access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. This enables you to access these services from any client that can parse and access data that is transmitted over standard HTTP protocols. For more information, see Making Changes to Data (ADO.NET Data Services).

ADO.NET Data Services supports HTTP requests and responses in more than one data format to accommodate various client applications and platforms. ADO.NET Data Services can represent data in JavaScript Object Notation (JSON) and Atom Publishing Protocol (AtomPub), which is the default format. The format of the payload is specified in the header of the HTTP request. For more information, see Payload Formats (ADO.NET Data Services).

ADO.NET Data Services also uses other existing Internet facilities for such operations as caching and authentication, and it integrates with existing hosting services, such as ASP.NET and Windows Communication Foundation (WCF). For more information, see Hosting the Data Service (ADO.NET Data Services).

Storage Independence

Although resources are addressed based on an entity-relationship model, ADO.NET Data Services expose data regardless of the underlying data source. After ADO.NET Data Services accepts an HTTP request for a resource that a URI identifies, the request is deserialized and a representation of that request is passed to an ADO.NET Data Service provider. This provider translates the request into a data source-specific format and executes the request on the underlying data source. ADO.NET Data Services achieves storage independence by separating the conceptual model that addresses resources from the specific schema of the underlying data source.

ADO.NET Data Services integrates with the ADO.NET Entity Framework to enable you to create data services that expose relational data. You can use the Entity Data Model tools to create a data model that contains addressable resources as entities and at the same time define the mapping between this model and the tables in the underlying database. For more information, see Entity Framework Provider (ADO.NET Data Services).

ADO.NET Data Services also enables you to create data services that expose any data structures that return an implementation of the IQueryable interface. This enables you to create data services that expose data from .NET Framework types. Create, update, and delete operations are supported when you also implement the IUpdatable interface. For more information, see Reflection Provider (ADO.NET Data Services).

Custom Business Logic

ADO.NET Data Services supports functionality beyond simply addressing data resources. You can add validation logic through service operations and interceptors. Service operations are methods defined on the server that are addressable by URIs in the same form as data resources. Service operations can also use query expression syntax to filter, order, and page data returned by an operation. For example, the URI https://localhost:12345/Northwind.svc/GetOrdersByCity?city='London'&$orderby=OrderDate&$top=10&$skip=10 represents a call to the service operation named GetOrdersByCity on the Northwind data service that returns orders for customers from London, with paged results sorted by OrderDate. For more information, see Service Operations (ADO.NET Data Services).

Interceptors enable custom application logic to be integrated in the processing of request or response messages by a data service. Interceptors are called when a query, insert, update, or delete action occurs on the specified entity set. An interceptor then may alter the data, enforce authorization policy, or even terminate the operation. Interceptor methods must be explicitly registered for a given entity set that is exposed by a data service. For more information, see Interceptors (ADO.NET Data Services).

Client Libraries

ADO.NET Data Services defines a set of uniform patterns for interacting with data services. This provides an opportunity to create reusable components based on these services, including client-side libraries that make it easier to consume these data services.

ADO.NET Data Services includes client libraries for both .NET Framework-based and Silverlight-based client applications. These client libraries enable you to interact with data services in terms of .NET Framework objects. They also support object-based queries and LINQ queries, loading related objects, identity resolution, and other behaviors that you may be familiar with from the Entity Framework. For more information, see Using a Data Service in a .NET Framework Application (ADO.NET Data Services).

See Also

Other Resources

ADO.NET Data Services

Getting Started with ADO.NET Data Services

Defining a Data Service (ADO.NET Data Services)

Accessing a Data Service (ADO.NET Data Services)

Using a Data Service in a .NET Framework Application (ADO.NET Data Services)

Representational State Transfer (REST)