How to: Expose OpenAccessContext via RIA 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.
You can use Telerik Data Access to map to your database tables and then expose those entities as part of WCF RIA Services. Telerik Data Access provides a WCF RIA Wizard that will automatically create the C# "plumbing" code and the necessary project files for using Telerik Data Access entities with the service. This topic will demonstrate how to expose a Telerik Data Access Domain Model via WCF RIA Service.
Suppose, you have an ASP.NET Web Application project and you have created a new Telerik Data Access Domain Model.
To create a new RIA Service based on the domain model:
- In Solution Explorer, right-click the server project, select Add and New Item.
-
In the list of categories, select Web and then select the Telerik Data Access Domain Service class template.
Give the file service a name and click Add.
-
The RIA Wizard appears.
There are three options. You can create domain service by using OpenAccessContext, Rlinq File or Fluent Metadata Source. The first two options are equivalent. If you have "code-only" scenario, i.e. you are using the Fluent Mapping API, then you need to select the third option (Fluent Metadata Source). You could find more information about Telerik Data Access Fluent Mapping API here. For the purpose of this tutorial select Rlinq file and press Next.
-
On the next step, you need to configure the Domain Service Endpoints.
Make sure that the Enable client access is checked. In the Available metadata sources drop-down, select the target Rlinq file. Check the Enable and Enable Edit settings for all entities in the grid control. Give the service a name (the Domain service name).
Click Finish to close the wizard and generate the service.
Next Steps
To see what is the outcome of the service generation, check out the Service Generation Outcome topic. To learn how to integrate Telerik Data Access with WCF RIA and Silverlight, check out the Silverlight and WCF RIA quickstart section.