Coming from WCF services with SOAP, this is a revolution. .Net Web API is really straight forward, easy to implement and powerfull, connectable for all systems.
For my iOS app, I'm switching from the old SOAP XML protocol to JSON, from WCF to web API and REST.
The first project was a succes after 1 day. The initial setup required almost no code, only scaffolding and some configuration.
I bumped into a small problem, which I document together with the solution in the following report.
The solution consist out of 2 projects, A class library and .Net Web API. To create the .Net Web API is really simple, look here if you do not know how. Next in the class libary I added an EF 6.0 model with some tables from my database. Add a reference to this class library project containing the EF Model to your web API project.
I removed the Model folder in the Web API because we use the model from EF project.
Now I click right on the Controller folder, choose add, controller. You'll see a choice of scaffolds to choose from.
We choose the Web API 2 Controller with actions, using Entity Framework. Then you'll see the add controller dialog, where you choose your model class from your entity model, and the data context. The choices should be there.
Now when you click add, it could happen that you'll get this error message (Unable to retrieve metadata for ''. No connection string named '' could be found in the application config file.):
The error is self explaining, you'll have to add the connection string for the EF in the web.config of your web API project. Copy the section from your app.config in the project where you have created the EF model, add it to the web.config of the Web API project.
Now try to add the controller scaffold again, it should work and you'll see the controller scaffold added to your project.
You can already test this controller in your browser.