共用方式為


WCF Data Services Client Library

Important

WCF Data Services has been deprecated and will no longer be available for download from the Microsoft Download Center. WCF Data Services supported earlier versions of the Microsoft OData (V1-V3) protocol only and has not been under active development. OData V1-V3 has been superseded by OData V4, which is an industry standard published by OASIS and ratified by ISO. OData V4 is supported through the OData V4 compliant core libraries available at Microsoft.OData.Core. Support documentation is available at OData.Net, and the OData V4 service libraries are available at Microsoft.AspNetCore.OData.

RESTier is the successor to WCF Data Services. RESTier helps you bootstrap a standardized, queryable, HTTP-based REST interface in minutes. Like WCF Data Services before it, Restier provides simple and straightforward ways to shape queries and intercept submissions before and after they hit the database. And like Web API + OData, you still have the flexibility to add your own custom queries and actions with techniques you're already familiar with.

Any application can interact with an Open Data Protocol (OData)-based data service if it can send an HTTP request and process the OData feed that a data service returns. This interoperability enables you to access OData-based services from a broad range of Web-enabled applications. WCF Data Services includes client libraries that provide a richer programming experience when you consume OData feeds from .NET Framework or Silverlight-based applications.

The two main classes of the client library are the DataServiceContext class and the DataServiceQuery<TElement> class. The DataServiceContext class encapsulates operations that are supported against a specified data service. Although OData 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<TElement> class represents a query against a specific entity set.

This section describes how to use client libraries to access and change data from a .NET Framework client application. For more information about how to use the WCF Data Services client library with a Silverlight-based application, see WCF Data Services (Silverlight). Other client libraries are available that enable you to consume an OData feed in other kinds of applications. For more information on OData SDK, see OData SDK - Sample Code.

In This Section

Generating the Data Service Client Library
Describes how to generate a client library and client data service classes that are based on OData feeds.

Querying the Data Service
Describes how to query a data service from a .NET Framework-based application by using client libraries.

Loading Deferred Content
Describes how to load additional content not included in the initial query response.

Updating the Data Service
Describes how to create, modify, and delete entities and relationships by using the client libraries.

Asynchronous Operations
Describes the facilities provided by the client libraries for working with a data service in an asynchronous manner.

Batching Operations
Describes how to send multiple requests to the data service in a single batch by using the client libraries.

Binding Data to Controls
Describes how to bind controls to a OData feed returned by a data service.

Calling Service Operations
Describes how to use the client library to call service operations.

Managing the Data Service Context
Describes options for managing the behavior of the client library.

Working with Binary Data
Describes how to access and change binary data returned by the data service as a data stream.

See also