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

Creating The New MVC Solution

In this task, you will create a new ASP.NET MVC web project, and the SofiaCarRental.Model class library. The web project will be the starting point for your application, and the class library will hold your fluent model.

  1. Start Visual Studio, on the File menu select New, and then select Project.
  2. In the New Project dialog box, select Visual Basic or Visual C# as the programming language.
  3. In the Templates pane, select ASP.NET MVC 4 Web Application.
  4. Type CarRentWebSite as the name of the project and click OK.

  5. In the New ASP.NET MVC 4 Project dialog box, select Internet Application. Leave Razor as the default view engine.

  6. Click OK. Visual Studio will create a new ASP.NET MVC project.

  7. Following the steps in the Creating The SofiaCarRental Model tutorial, create the SofiaCarRental.Model project, which holds the fluent model.

  8. Integrate the Telerik.DataAccess.Core NuGet package with the CarRentWebSite project.
  9. In the CarRentWebSite project, add a reference to the SofiaCarRental.Model project.
  10. Copy the SofiaCarRentalConnection connection string from the App.config file of the SofiaCarRental.Model project to the Web.config file of the SofiaCarRentalWebApp project.

       <add name="SofiaCarRentalConnection" 
            connectionString="data source=.\sqlexpress;
                              initial catalog=SofiaCarRental_v2.2;
                              integrated security=True" 
            providerName="System.Data.SqlClient" />
  11. 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.

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

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