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

Adding References and Connection String

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.

In this task, you will add references to the required assemblies and connection string information in the CarRentWebSite project.

Adding References in the CarRentWebSite Project

  1. In Solution Explorer, right-click the CarRentWebSite project and select Add Reference. This displays the Add Reference dialog box. Add a reference to the following Telerik Data Access assemblies:

    1. Telerik.OpenAccess.dll
    2. Telerik.OpenAccess.35.Extensions.dll
  2. Again, in Solution Explorer, right-click the CarRentWebSite project and select Add Reference. In the Add Reference dialog, navigate to the Projects tab page, select CarRentWebSite.Telerik Data Access and press OK.

  3. In Solution Explorer, expand the References node for the CarRentWebSite project. Select the Telerik.OpenAccess.dll assembly, press F4 to open the Properties pane and set the Copy Local property to True.

Adding Connection String Information in the Main (CarRentWebSite) Project

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:

  1. Open the App.Config file in the SofiaCarRentalLibrary project.
  2. Copy the connection string.

  3. Open the Web.Config file in the CarRentWebSite project and paste the connection string in the <connectionStrings/> section.

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
     <configSections>
     </configSections>
     <connectionStrings>
    
       <add name="SofiaCarRental21Connection"
            connectionString="data source=.\sqlexpress;initial catalog=SofiaCarRental21;
                              integrated security=True"
            providerName="System.Data.SqlClient" />
    
     </connectionStrings>
     <!--More configurations-->
    </configuration>
    

More information could be found in the Consuming a Model - Configuration topic.

At this point the model is fully configured. Next, you will learn how to handle the OpenAccessContext in web applications.