I am trying to find some information about the preferred solution setup when using MVC 2 and Entity Framework, and it would seem to me the most intuitive to install this web application in 3 layers:
- MyProject.Web (MVC project for presentation)
- MyProject.Data (Data Gateway Layer Using the Entity Framework for Working with the Database)
- MyProject.Tests (test project created when setting up a new MVC project)
This seems to contradict the examples I find and the documentation (for example, the NerdDinner example) that view the MVC project as a mediation directly with the database. Example NerdDinner puts data access in a repository class mixed with MVC models.
I tried to take the path that seems best to me and created my "ADO.NET Entity Data Model" element in my separate Data project, but this gives me an error when I try to use MVC to list the elements in it:
"Unable to load the specified metadata resource."
if I don't have a copy of the entity data model in my MVC project.
Before I go too far along the path of studying this error, I want to find out if I am against fighting the framework of purism, when they simply discipline me, only using access to data in my repository.
like this: - Is it possible or recommended to put my Entity Framework in this other project? “Will I sacrifice some other MVC features, dividing it this way?” (for example, checking?) - If I am heading in the right direction and others agree, are there any other examples or documents that someone could point me to?
source share