开发者

MVC 2 Models Directory

开发者 https://www.devze.com 2023-01-16 03:11 出处:网络
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 dire

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消