Data Access has been discontinued. Please refer to this page for more information.

How to: Expose OpenAccessContext via REST Service

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.

Telerik Data Access provides support for REST Services. This means that you will be able to easily leverage the power of Telerik Data Access in your application. Telerik Data Access provides the Service Wizard that allows you to generate REST Services based on Telerik Data Access Domain Model or Fluent Model. This topic will show you how to achieve this task.

Suppose, you have an ASP.NET Web Application project and you have created a new Telerik Data Access Domain Model.

To create a new REST Service based on the domain model:

  1. 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.

  2. This will bring up the Service Wizard. The first page of the wizard is the Select Source and Output dialog. From the Select context drop-down select your domain context. By default, it is named EntitiesModel. From the Host in Project drop-down select the project that will contain the service file. In this example, the project that contains the domain model and the project that will contain the generated service are the same - WebApplication. Check the Use Existing Project option and select your web project.

  3. Click Next to continue. The Select Service Type dialog appears. You need to select the service type. Select WCF EndPoints Service.

  4. Click Next. In the Service Configuration dialog, you need to 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. More special is the case when your domain model contains views (e.g. ProductsByCategory, Invoice, CurrentProductList, AlphabeticalListOfProduct). You can use the views only for read operations. By default, if your view doesn't have a primary key, the corresponding entry in the Add Telerik Data Access Service wizard is disabled. If you want to expose a view through a service, you need to specify a primary key in the Visual Designer.

  5. Once all selections are done, click Next to proceed. In the Preview dialog, review all changes that will be done in your project.

  6. Click Finish to generate the service.