Creating ASP.NET Web API Controllers
This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.
ASP.NET Web API allows you to serialize your domain classes to JSON, XML, or some other format, and then write the serialized data into the body of the HTTP response message. As long as a client can read the serialization format, it can deserialize the object. Most clients can parse either XML or JSON. Furthermore, the client can specify which format it wants by setting the Accept header in the HTTP request message.
In this task, you will create Web API Controllers for your domain classes. A controller is an object that handles HTTP requests.
- Build your solution.
- Right-click the RLINQ file in Solution Explorer and select Add Telerik Data Access Service..... If you don't have a RLINQ file, e.g. you have a Fluent Model project, you can start the wizard by using the context menu of the Web Application where the service will reside.
-
This will bring up the Service Wizard. The first page of the wizard is the Select Source and Output dialog. Use the default configuration and click Next.
-
The Select Service Type dialog appears. Select ASP.NET Web API Service and click Next.
-
In the Service Configuration dialog, select which entities to be generated as part of the service. By default all entities are selected. Also you have the option to specify what CUD operations can be performed on the generated entities. Select all entities and click Next to go to the last page of the wizard.
-
In the Preview dialog, review all changes that will be done in your project.
-
Click Finish to generate the Api Controllers.