How to: Expose OpenAccessContext via Data 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 WCF Data 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 WCF Data 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 Data Service based on the domain model:
-
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. 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.
-
Click Next to continue. The Select Service Type dialog appears. You need to select the service type. Select WCF Data Service.
For more information about the WCF Data Service versioning, please read here.
-
Click Next. In the Service Configuration dialog, you need to give the service a Name. 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. 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.
-
Once all selections are done, click Next to proceed. In the Preview dialog, review all changes that will be done in your project.
-
When you click Finish, the wizard will ask you to confirm the download of a NuGet package with the latest Microsoft.Data.Services assembly.
Next Steps
To see what is the outcome of the service generation, check out the Service Generation Outcome (Version1) and Service Generation Outcome (Version3) topics. To learn how to integrate Telerik Data Access with WCF Data Services and Silverlight, check out the Silverlight and WCF Data quickstart section.