WCF Data Services Protocol Implementation Details

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.

OData Protocol Implementation Details

The Open Data Protocol (OData) requires that a data service that implements the protocol provide a certain minimum set of functionalities. These functionalities are described in the protocol documents in terms of "should" and "must". Other optional functionality is described in terms of "may". This article describes these optional functionalities that are not currently implemented by WCF Data Services.

Support for the $format Query Option

The OData protocol supports both JavaScript Notation (JSON) and Atom feeds, and OData provides the $format system query option to allow a client to request the format of the response feed. This system query option, if supported by the data service, must override the value of the Accept header of the request. WCF Data Services supports returning both JSON and Atom feeds. However, the default implementation does not support the $format query option and uses only the value of the Accept header to determine the format of the response. There are cases when your data service may need to support the $format query option, such as when clients cannot set the Accept header. To support these scenarios, you must extend your data service to handle this option in the URI.

WCF Data Services Behaviors

The following WCF Data Services behaviors are not explicitly defined by the OData protocol:

Default Sorting Behavior

When a query request that is sent to the data service includes a $top or $skip system query option and does not include the $orderby system query option, the returned feed is sorted by the key properties, in ascending order. This is because ordering is required to ensure the correct paging of results. To do this, the data service adds an ordering expression to the query. This behavior also occurs when server-driven paging is enabled in the data service. For more information, see Configuring the Data Service.To control the ordering of the returned feed, you should include $orderby in the query URI.

See also