11
votes

Could someone compare and contrast on WCF Rest services vs. ADO.NET Data Services? What is the difference and when to use which?

Thanks,

Ray.

Edit: thanks to the first answer, just to give a bit background on what I'm looking to do: I have a web app I plan to put in the cloud (someday), the DAL is built with ADO.NET Entity Framework. And, I need to figure which web service data access technology would best fit my case.

5
Note to Googlers: ADO.NET Data Services was renamed to "WCF Data Services" about a year after OP's post. See en.wikipedia.org/wiki/WCF_Data_Services. Now that we know WCF Data Services are an WCF implementation of ODATA, the "REST" aspect is a requirement of OData anyway thus WCF Data Services are OData and therefore REST. This was the case prior to the name change too. docs.microsoft.com/en-us/dotnet/framework/data/wcf - Micky

5 Answers

15
votes

Not sure I can give a complete answer here but I spent a lot of time at PDC trying to figure this out myself so here’s a go...

The short answer here is that ADO.Net Data Services are meant to provide an interface to the ADO.Net framework (DataContext, Datasets, DataTables etc…) that is seamlessly integrated with the web, using URIs and well-known data to point to your Data. ADO.Net Data Services are also meant for programming ADO.Net in the cloud. Microsoft's Cloud services, "Azure", is a new cloud programming platform that will be release in the near future. For more info on Cloud Services go here.

One cool thing I found out about ADO.Net Data Services and the cloud is that the underlying DataContext that acts as the provider to your data source can be easily configured to point your resource in the cloud, or, an on premise database. This allows you to switch your DataContext without changing any code!!! (I was impressed by that if you couldn't tell)

WCF Rest Services are just normal WCF Services that have added functionality so that they can be consumed in a RESTful manner (URI vs URL, Usage of HTTTP Verbs, Usage of Different Data Transfer Formats like JSON, YAML, etc...). So for example, if you had a stock ticker web service that you built in WCF, instead of requiring the caller to use a heavy WSDL implementation and ASMX, you could just use the WCF Rest functionality to publish that service as a JSON service instead and have it consumed via AJAX without having to point to an ASMX resource. For more info on WCF using rest check out the PDC Presentation

1
votes

Thank you so much for the insight! For my app, I do plan to put it in the cloud and I also used ADO.NET Entity Framework to build my DAL, so it sounds like ADO.NET Data Services is the one for me to choose.

One cool thing I found out about ADO.Net Data Services and the cloud is that the underlying DataContext that acts as the provider to your data source can be easily configured to point your resource in the cloud, OR, an on premise database. This allows you to switch your DataContext without changing any code!!! (I was impressed by that if you couldn't tell)

Could you maybe say more on this point regarding how ADO.NET Data Service + EF would work in the cloud?

1
votes

If you want to develop and deliver a data centric service, in certain cases a lot of functionalities can be achieved by both the WCF rest starter kit and WCF data service, as both of these technologies of WCF can deliver your data in a RESTful way (e.g. with addressable content with URLs and standard formats of data such as xml and json). They also both equip with an array of .NET classes for dealing and handling a lot of network and web requests such as HTTP interceptors and cache.

However, one advantage that WCF data service owns but not the REST starter kit is that WCF data service can expose its data in the form of .NET entity objects and in standard formats(this is achieved by the OData protocal). So I guess WCF data service would give you more versatile performance in a lot of real world scenarios.

1
votes

One of the main difference between ADO.Net Data services and WCF Rest Services is that REST services are light weight and you can customize what to get by writing separate methods/functions while ADO.Net Data services are more like a dump that you get everything...so for web and RIA applications, in my opinion, WCF Rest services is the Best and optimized choice...

0
votes

WCF Data Services (previously known as ADO.NET Data Services), http://msdn.microsoft.com/en-us/data/aa937697.aspx