Search code examples
.netasp.net-mvcwcfwcf-data-servicesasp.net-web-api

WebAPI WCF contract capabilities available


I was wondering what everyone's thoughts are on allowing WebAPI to be contract based as well as ReSTFul. I am a big believer that both have their place and I could definetly see advantages to providing my current MVC applications the ability to use the WCF contract technique our WCF services provide while also providing a ReSTFul API for third party applications that need access to our data. Also, I know that most examples show the ability to do this by having the WebAPI part of your MVC project, but I wish to have them on seperate machines for various security or availability concerns.


Solution

  • In my opinion WebAPI is still going through a lot of changes. I like where it's headed, but the latest OData implementation for web api is in alpha, and it does not implement the full OData spec. I'm also not to excited about losing contracts, forcing server side calls to use strings.

    If I were implementing something today I would consider a combination of WCF Data Services and WCF Rest. This will give you the same RESTful interface and OData support from WebAPI, but will also expose contracts for the code-behind stuff.