Using Database First
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.
This topic demonstrates how to use the Database First Approach to implement your Model. The Domain Model you are going to build will be based on the SofiaCarRental database:
- Right-click the CarRentWebSite solution in Solution Explorer and select Add > New Project...
- In the list of Installed Templates on the left side of the dialog, select Visual C# or Visual Basic.
-
Then select Telerik Data Access Class Library. Name the project CarRentWebSite.Telerik Data Access and click OK.
This will start the Telerik Data Access New Domain Model Wizard. The first step in the wizard lets you choose the type of model you want to use. In this step, you have the option of generating a model from a database or starting with an empty model. This topic deals with generating a model from an existing database, so select the Populate from Database option. Select the backend provider (the default backend is MSSQL).
-
Give the model a name or use the default one, and click Next to proceed.
The next page in the wizard lets you specify the data connection for your domain model. If you have previously created connections they will show up in the list. Create a data connection to the SofiaCarRental database and click Next.
- In the Choose Database Items screen, select all tables.
-
Click Finish to generate your model. Persistent classes are generated for all tables from the SofiaCarRental database. The wizard adds the EntitiesModel.rlinq file to the CarRentWebSite.Telerik Data Access project. Also references to the Telerik.OpenAccess.dll and Telerik.OpenAccess.35.Extensions.dll assemblies are added.
Build your solution.
In the next task, you will add references to the required assemblies and connection string information in the CarRentWebSite project.