ADO.NET Data Services provide a very simple way for the servers to publish data. However, it lacks of flexibility in terms of processing the data before forwarding it to the clients. In this paper, I show a simple approach that provides business logic processing before forwarding data to the clients.
The world of web services encounters another trend by REST-full services after the invention of SOAP based protocols. The acronym REST stands for Representational State Transfer; this basically means that each unique URL is a reference to a resource. The main advantage of REST services is their simplicity compare to the SOAP based services. REST services use the tradition HTTP methods to do the basic CRUD operations. For example, the HTTP GET method is used to address an object or a resource, whist the DELETE HTTP method is used to delete a resource on the server. The POST and PUT HTTP methods are used to update or create data on the server too. REST services can be used by a simple web browser without any special knowledge about protocols or any special tool and it makes them available to a variety of different clients and nowadays using REST services is a robust approach for publishing data on the web.
Microsoft makes a big stride in developing REST services by introducing ADO.net Services. Known as WCF Data Services in the Framework 4.0, they allow a very simple way to expose database tables as REST-full services. Data Services can be published on a Web Server or any other WCF Host environment and in one word; there is a bunch of different hosting options. The process of creating them is very simple too. At first, one should create an Entity Framework and then maps the tables to conceptual classes in the entity framework. Secondly, he/she should create a Data Service and finally, configuring the Entity Framework in the InitilizeService method of the data service. Pretty simple! Isn’t it?