Creating MVC4 Application with Model First Entity Framework

Before going to the details please refer the following URL to create simple web application Using Asp.Net MVC 3. How to Create Website using ASP.Net MVC
In this post we will see how to create simple MVC 4 Application with Model First Entity Framework.

First we see how to create simple application using Asp.Net MVC4

  • In Visual Studio 2010, add a new project by selecting the File menu, then New and then Project.
  • In the Search Installed Templates text box (top right), type MVC 4 to filter down the list of project templates.
  • Select ASP.NET MVC 4 Web Application using your language of choice. This walkthrough will use C# code.
  • Name the project MyFirstMvcApplication and then click OK.
  • In the New ASP.NET MVC 4 Project wizard, choose Internet Application.
  • Leave the default values of the other options and click OK. 

Create a model  using Entity Framework

           In MVC the "M" stands for model,the model is a class that represent our application domain.In this post we will see how to create a model to you application using Entity framework Entity Data Model (EDM) concept.
  1.  In Solution Explorer, right click on Models folder select "Add" and select "New Item"
  2. In the Add New Item dialog, type Entity in the search box in the upper right hand corner.
  3. Select ADO.NET Entity Data Model from the filtered list of item templates.
  4. Change the name of the model to MyFirstEntityModel.edmx.
  5. In the Choose Model Contents window. Select Empty Model and then click the Finish button.
dddd

No comments:

Post a Comment