This is an awesome 20 page article about OData and WCF Data Services. If you need an intro to these two, you need to read this article.
Table of Contents
- What is this Article About?
- What are OData, Atom, and AtomPub?
- REST vs. SOAP: The Design Decisions
- First look at OData Queries
- Working with OData via WCF Data Services
- Creating a WCF Data Service with POCOs
- Behind the Scenes
- Enabling JSON Format through WCF Message Inspector
- What about JSON light?
- JSON Light in WCF Data Services 5.2.0
- Extending Data Service with Service Operations and Interceptors
- Metadata, EDM, and CSDL
- Concurrency Updates with ETAG
This is not your typical “expose an entity framework model as a WCF Data Service” kind of article; in fact I deliberately omitted Entity Framework from this discussion. Now don’t get me wrong, I have nothing against EF, but you will find a lot of great articles on how to set up a WCF Data Service using EF as data source.
The discussion is around OData v3 and WCF Data Services 5.0 and 5.2. Of course there is no way I cover all new features or every API available, nor do I need so; I will point you to the resources where you can get all information you need. Instead my aim in this article is to discuss some of the topics that usually remain oblivious to the typical WCF Data Services developer.
The Open Data Protocol (OData) is a protocol which standardizes the exposure and consumption of data. In times where data is being exposed at high rates and where consumers connect to more and more data endpoints, it’s important for clients to access these endpoints in a common way.
OData builds on web standards such as Http, Atom, and JSON to provide REST-based access to these endpoints. Data is exposed as entities where each entity can be treated as an Http resource which makes it subject to CRUD (create, read, update, delete) operations.
So how is OData related to Atom and AtomPub?
Atom is way to expose feeds much the same way RSS does. If you are wondering what are the differences between Atom and RSS you can check this site (http://en.wikipedia.org/wiki/Atom_(standard)#Atom_compared_to_RSS_2.0)
Atom by itself allows only feed exposure. If you want to publish data, AtomPub (Atom publishing) provides this ability. AtomPub uses Http verbs GET, POST, PUT, and DELETE to enable data publishing.
OData adds a set of extensions on top of AtomPub to enable more advanced and smart operations such as data retrieval filtration and typed values definition. For example, below are two queries that are made possible through the power of OData:
- http://server/service.svc/entity?$filter=(entityID add 4) eq 8