Thursday, September 13, 2012

Separating the Model and the Controller+View in different projects in MVC4 and EF5

Created a solution in visual studion 2012. (MyProject)
Created a web/UI MVC4 project using the provided template. (MyProject.UI)
Created a data access layer project. (MyProject.DAL)

Using entity framework 5 connected to sql server database and created edmx file in the DAL project.
Build the DAL project.
Go to the UI project and add a reference to the DAL project.

Copy the connection string from app.config of the DAL project to the web.config of the UI project.
This will ensure you don't get the following error:

Unable to retrieve metadata ...... No connection string named .... could be found ......




No comments:

Post a Comment