Microsoft has recently released their latest technology helping the N-Tier development – the ASP.NET Web API framework. If you haven’t had the opportunity to experience this new platform built around the HTTP protocol, here we try to address some of the key points about Web API services as answers to the most common questions you might be already asking: 

What is Web API?

ASP.NET Web API is the latest platform provided by Microsoft for creating HTTP-based services. 

When can I use Web API?

The Web API framework is not limited to any kind of architecture. You can build REST services on top of it or you can use plain HTTP endpoints only. You can consume your services from HTML5 front-ends, mobile applications, or in classic client-service scenarios. 

What do I need to install in order to use it?

Web API is currently delivered as part of ASP.NET MVC4, but you can also install it through a Nuget package

How can OpenAccess ORM help me?

Manual coding of a Web API service can be a lengthy task when you would like to expose your data model or even a part of it. As a start, you should install the latest version of the Microsoft.AspNet.WebApi Nuget package which will configure your application by adding the necessary references to enable Web API usage. Then, for each of your entities you will have to create a Web API controller class, inheriting the System.Web.Http.ApiController and providing all the CRUD operations which in the Web API case are the good old HTTP commands Get, Post, Put and Delete. Apart from that, you might want to create repositories for the entities so that you can query them. All that, together with getting to know the Web API specific naming conventions and fighting with various problems, can easily cost you days of meaningless coding and resolving issues.

This is where we would like to help you. For Q3 2012, we have implemented Web API support in our Add OpenAccess Service wizard, which is already well-known for helping developers skip the boring code when they implement various kinds of services! See how easy it is:

1. Select your Domain Model or Fluent Mapping Source and then the type of the service to be generated:

2. Choose the classes you would like to expose and the operations you want to allow on each of them:

3. Review the changes we intend to make on your host web application, click Finish and the wizard will ask you to confirm the download of the Nuget package:

4. After confirming the download, the package will be installed, adding the necessary references. The wizard will also generate the code exposing all the entities – the controllers and a generic class for repositories. While the service is fully customizable, it can also be used right away so that your data is already available to other tiers of your application!

As you can see, with each and every release we are trying to help you to concentrate on the important parts of your complex N-Tier solutions by writing the boring code for you. We are looking forward to sharing the other cool new features expected in Q3 2012 of Telerik OpenAccess ORM in the next days, so stay tuned.


Click to download your free copy of OpenAccess

About the Author

Ivailo Ivanov

 is Team Lead in Telerik Data Access


Comments are disabled in preview mode.