Wednesday, September 12, 2012

Introduction to WCF Data Services and OData

WCF Data Services (formerly known as ADO.NET Data Services and codename is “Astoria”) is a platform for what Microsoft calls Data Services. This is a component of the .NET Framework that enables you to create services that use the OData(Open Data Protocol) to expose and consume data over the web or intranet by using the semantics of Representational State Transfer (REST).

Before moving forward let me give a introduction to OData first.

OData(Open Data Protocol)

The Open Data Protocol is a Web protocol for querying and updating data. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.

What happens in OData is Servers hosts data and Clients can consume/manipulate or update these data. The end point on the server is also known as a Service. The protocol is HTTP based and we can use standard HTTP verbs of GET, PUT, POST, and DELETE to interact with the service. The data is send between the Server and Client using Atom Publishing Protocol (AtomPub - a set of standards for exchanging and updating data as XML) and JavaScript Object Notation(JSON - a text-based data exchange format used extensively in AJAX application) notations. Since the protocol is HTTP based, any application written in any programming language which has HTTP stack can communicate with this service.

Now how WCF Data Services and OData comes together is WCF Data Services uses the OData protocol for addressing and updating resources. In this way, you can access these services from any client that supports OData. WCF Data Services also includes a set of client libraries, one for general .NET Framework client applications and another specifically for Silverlight-based applications. These client libraries provide an object-based programming model when you access an OData feed from environments such as the .NET Framework and Silverlight.

I am hoping to show you how to access an OData feed from a Silverlight application in a coming post.

Happy Coding.

Regards,
Jaliya