Tech Junkie Blog - Real World Tutorials, Happy Coding!: End-to-End ASP.NET MVC 5 : Create Entity Data Model With Entity Framework

Saturday, June 18, 2016

End-to-End ASP.NET MVC 5 : Create Entity Data Model With Entity Framework

In our previous blogs we've created an ASP.NET MVC from scratch.  In this blog we are going to use Entity Framework as the ORM (Object Relational Mapping) as a conduit to our database, so that we can query our data as an object.  An ORM as the name implies maps database tables, views, and stored procedures as objects in a programming language so that developers can work with the data as objects.

Step-by-Step Instructions:

1.  First we need to add the Entity Framework 6.1.3 to our ASP.NET MVC, we accomplish by right-click on "References" then select "Manage NuGet Packages"

2. On the search box type in "EntityFramework" no spaces, in the search result click on the "Install" button next to the "EntityFramework" package.

3.  Click "I Accept" on the "Licence Acceptance" screen

4. Click "Close"

5.  Once the "EntityFramework" package has been added you will see a green checkmark next to the "EntityFramework" search result.

6.  If you look at the "References" in the project you will now see the EntityFramework references

7.  Now we are ready add a database model to our project.  We will add the "Northwind" database to our project.  Right-click on the "Models" folder, then select "Add" → "New Item"

8.  Select "Data" on the left pane under "C#" then select "ADO.NET Entity Data Model" the main pane

9. In the "Name" field for the item type "NorthwindModel"

10. Click the "Add" button

11.  On the "Choose Model Contents" screen, select "EF Designer from database"

12. On the "Connection Properties" screen, click on the "New Connection" button

13. In this screen select type in the SQL server name, or select it from the "Server name" dropdown list.  Then type "Northwind" or select it from the "Select or enter a database name" dropdown list.  Then click "OK".  If you don't have the Northwind database in your database server, you can follow the instructions in this blog to add it.

14. All the database connection information should be configured correctly in the "Entity Data Model Wizard" now.  Click "Next"

15.  For the database objects to include, select "Tables", "Views", and "Stored Procedures and Functions" then click "Finish"

16.  The Entity Framework models and classes are now added to the project.

17.  If you click on the "NorthwindModel.edmx" file the model will be visually presented in the model designer editor

18.  Build the project, and that's it


  1. Do you wish to buy the best scope for Best budget Scope for AR 15 under $100? ? It is true that people loves to hunt wild animal. However, you must have a complete accessory for hunting. We know that the most used guns are AR 15.

  2. Thanks for sharing this.,
    Leanpitch provides online training in A-CSPO during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days A-CSPO Certification Workshop in different cities.

    a-cspo certification
    a-cspo training

  3. We are looking for a lot of data on this item. In the meantime, this is the perfect article I was looking for . Please post a lot about items related to 메이저놀이터추천 !!! I am waiting for your article. And when you are having difficulty writing articles, I think you can get a lot of help by visiting my .

  4. You might collect a dissertation that is due in a couple of days but don't have the time to complete it. You can use a dissertation help service to have an dissertation expert work on your dissertation right away, rather than spending sleepless hours on it. You can focus on other things while the dissertation expert online completes the task and sends it to you before the deadline.

  5. excellent post, very informative. I wonder why the other experts of this sector don’t notice this. You should continue your writing. I am confident, you have a huge readers’ base already! 메이저사이트

  6. Wonderful post however , I was wanting to know if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit further. Bless you! 온라인경마

  7. I gotta favorite this site it seems extremely helpful very helpful 토토


Search This Blog