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

How to: Refer Telerik® Data Access Library from Other Projects

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.

When you use the Telerik Data Access Class Library template in Visual Studio, a new Class Library project will be added to the solution, and the Telerik Data Access New Domain Model Wizard will run. Once the domain model is configured, a new RLINQ file will be added to the project. With the model in its own project, you are able to re-use it in different applications. It is a best practice to create your Telerik Data Access Domain Model in its own project and there are few steps you need to be aware of when you want to use the domain model from another project.

This article illustrates how to use (refer) Telerik Data Access Class Libraries in other projects. Suppose, you have the following Telerik Data Access Class Library project:

The OpenAccessModel project contains two items. The first one is the domain model, i.e. the rlinq file. The second file is a configuration file containing the connection string to the target database.

There are two general scenarios:

  • Referring a Telerik Data Access Class Library from another class library project.
  • Referring a Telerik Data Access Class Library from the main (executable) project.

Referring a Telerik Data Access Class Library from Another Class Library Project

The OpenAccessModel assembly contains your domain model. Suppose, you want to refer the assembly in another class library projects (e.g. Windows Forms Control Library, WPF Custom Control Library, WPF User Control Library, etc.).

To refer a Telerik Data Access Class Library from another class library project, you need to perform the following actions:

  • In the second class library project, add a reference to the Telerik Data Access Class Library assembly(e.g., OpenAccessModel).
  • In the second class library project, add references to the Telerik.OpenAccess.dll and Telerik.OpenAccess.35.Extensions.dll assemblies. Also you might need to add other Telerik Data Access assemblies, depending on the functionality you are using.

Referring a Telerik Data Access Class Library from Client Projects (WebSite, Web Application, Exe, etc.)

In order to use the model in client projects, you need to perform three steps:

  • In the main project, add a reference to the Telerik Data Access Class Library assembly (e.g., OpenAccessModel).
  • In the main project, add references to the Telerik.OpenAccess.dll and Telerik.OpenAccess.35.Extensions.dll assemblies. Also you might need to add other Telerik Data Access assemblies, depending on the functionality you are using.

    For ASP.NET MVC projects, you need to set Copy Local for Telerik.OpenAccess.dll to True - In Solution Explorer, expand the References node for the client project. Select the Telerik.OpenAccess.dll assembly, press F4 to open the Properties pane and set the Copy Local property to True.

  • The last step is to ensure that the client project "has" the ability to know about the domain model, i.e. to have an access to the database connection string used by the rlinq file. What you normally do when you have an existing config file in the client project is to copy the connection string from the App.config in the library project and paste it in the <connectionStrings/> section in the client config file.

    If you don't have an existing config file in the client project, as in this example, you simply could copy and paste the entire config file.

For more information about this scenario, you could refer to Consuming a Model - Configuration.

For further reference, check out the Managing the OpenAccessContext section: