Wednesday, May 1, 2013

Difference between ASP.Net Web API and WCF Data Services (OData)

Web API is a subset of feature offered by Odata Protocol and easy to build

                ASP.Net web AP
WCF Data Service
1.      Use this when you want to build a application that will be driven by URL such as MVC based UI application
2.      This is used to build an web application that confirms to REST but not targets to OData protocol but confirms to subset of protocol           
1.      Theses are pure backed services and usually consumed by some UI application.
2.      Fundamental use of Data Service is to expose plain data base tables and relation between the tables as XML response stream so that large amount of data can be transferred across heterogeneous consumers

Additional Collate
  1. WCF Data Services requires something like a DataContext. Web API doesn't.
  2. Web API is a way to add a pure http API to your application. It can be hosted in MVC, webforms, in a console app etc. 
  3. It's much simpler to implement an http API with Web API (very similar to MVC controllers with routing being similar).
  4. If you expose an IQueryable, you get basic ODATA support (like filtering, ordering etc.)
  5. In other words I would say that both data service and WebAPI both confirms to REST but data service also confirms to OData(That is further extention of REST ), while WebAPI do not even target it

No comments:

Post a Comment