Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put Entity Framework Data Model in MVC application?

Lets consider default ASP.NET MVC application folder structure, so it's looks like this:

-App_data
-Content
-Controllers
    HomeController.cs
-Models
    AccountModels.cs
-Scripts
-Views

My question is: Where is the best place to put Entity Framework Data Model (EDMX) file? Is it Models folder? Yes - we know that good solution is to introduce new Project and reference it to MVC application, but lets forget about this now.

like image 692
Dariusz Avatar asked Jan 16 '11 21:01

Dariusz


People also ask

Where does Entity Framework fit in application?

As per the above figure, Entity Framework fits between the business entities (domain classes) and the database. It saves data stored in the properties of business entities and also retrieves data from the database and converts it to business entities objects automatically.

Where is data stored in MVC?

If you're asking whether it is stored on the stack or on the heap, the response is: on the heap. Instance variables for a reference type are always on the heap.


1 Answers

For a small project, it should be part of the Model. For a larger product, the repository and the associated model could be in a separate assembly.

like image 82
George Stocker Avatar answered Sep 22 '22 19:09

George Stocker