Skip to main content

WCF Data Services and OData At-a-Glance

Data today tends to exist in horizontal or vertical silos: it can be shared within a particular environment but often becomes difficult (if not painful) to use beyond its original intent.  As systems continue to become more interconnected, the need to reuse information also grows and the value of any given data becomes greater the more it can be shared and accessed by other systems. The “silo effect”, on the other hand, limits that access and the data's value.

The Open Data Protocol, referred to as OData, is a new data-sharing standard that breaks down silos and fosters an interoperative ecosystem for data consumers (clients) and producers (services) that is far more powerful than currently possible. It enables more applications to make sense of a broader set of data, and helps every data service and client add value to the whole ecosystem. WCF Data Services (previously known as ADO.NET Data Services), then, was the first Microsoft technology to support the Open Data Protocol in Visual Studio 2008 SP1. It provides developers with client libraries for .NET, Silverlight, AJAX, PHP and Java. Microsoft now also supports OData in SQL Server 2008 R2, Windows Azure Storage, Excel 2010 (through PowerPivot), and SharePoint 2010. Many other other applications in the works.

In addition to client libraries that simplify working with OData, the Data Services framework builds on the general WCF capabilities to provide a near-turnkey solution for creating OData services for the web. Data Services enable you to expose data models to the Web in a RESTful way, with rich built-in data access capabilities such as flexible querying, paging, and association traversal.

The Data Services framework facilitates the creation of flexible data services that are naturally integrated with the web. WCF Data Services use URIs to point to pieces of data and use simple, well-known formats to represent that data, such as JSON and ATOM (XML-based feed format). This results in the data service being surfaced as a REST-style resource collection that is addressable with URIs and with which agents can interact using standard HTTP verbs such as GET, POST, PUT or DELETE.

In order for the system to understand and leverage semantics over the data that it is surfacing, Data Services models exposed data exposed using the Entity Data Model (EDM), an Entity-Relationship derivative. This organizes the data in the form of instances of "entity types" (or "entities") and the associations between them.

For relational data, Data Services supports exposing an EDM model created using the ADO.NET Entity Framework. It also includes a provider model that enables any data source (including non-relational sources) to be represented using the EDM and exposed as a data service.