In this task, you will add references to the required assemblies and connection string information in the CarRentWebSite project.
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:
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.
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.
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:
- Open the App.Config file in the SofiaCarRentalLibrary project.
Copy the connection string.
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.