MVC 2 Models Directory
I am busy with an MVC 2 project. I have my entity framework 4 .edmx file in a different project and referenced into my web application. I'm not too sure when I will create model files in my Models directory (created by the MVC application) if my .edmx file is in a separate project.
开发者_StackOverflow社区Please can someone help on this confusion. I would appreciate some samples regarding my scenario.
Thanks.
You don't have to put your Models in the 'Models' folder but it is just a best practice that the framework has suggested. I personally have ONLY my view models in the 'Models' directory and have one for each view. I then map my models/objects from my ORM to these models so that the objects passed back from my data access layer are not the ones I am passing to my views. Normally my DAL classes don't map 1 to 1 to my view models.
You could place your View Models into this directory.
精彩评论