Telerik OpenAccess ORM

Telerik OpenAccess ORM Send comments on this topic.
Using Database First
Programmer's Guide > Quick-Start Scenarios > ASP.NET MVC > Creating the Model > Using Database First

Glossary Item Box

RELATED VIDEOS

In this video you will learn how to create an MVC 3 application using OpenAccess ORM. In addition, you will build a data model based on an existing database, and learn how to work with the OpenAccessContext object in an MVC application.

Building a MVC 3 Application Database First With OpenAccess - Creating the Model

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:

  1. Right-click the CarRentWebSite solution in Solution Explorer and select Add > New Project...
  2. In the list of Installed Templates on the left side of the dialog, select Visual C# or Visual Basic.
  3. Then select Telerik OpenAccess Class Library. Name the project CarRentWebSite.OpenAccess and click OK.


  4. This will start the OpenAccess 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).
  5. Give the model a name or use the default one, and click Next to proceed.


  6. 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.
  7. In the Choose Database Items screen, select all tables.
  8. 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.OpenAccess project. Also references to the Telerik.OpenAccess.dll and Telerik.OpenAccess.35.Extensions.dll assemblies are added.


  9. Build your solution.

 

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