开发者

asp.net MVC 3 folders purpose

I am working on an asp.net MVC 3 project as a team member. This project has some folders like repositories, infrastructure, Datalayer, services, providers and ViewModels. When I create an asp.net MVC 3 application, It has only 5 folders views, models, controllers, contents and scripts. Why these additional folders are created. I read in an article (http://msdn.microsoft.com/en-us/library/aa973811.aspx) that service i开发者_开发知识库s an object that performs a distinct part of the application functionality and Repositories are strongly typed classes that provide create/read/update/delete for objects. what is difference between service and repository. If I name these folders to something else will it make any difference. What type of classes should go in below folder classes:

repositories
infrastructure
Datalayer
services
providers
ViewModels

I read somewhere that repository is a pattern what does it mean? Also are services also a pattern?

Please suggest

Regards,

Asif Hameed


It is most likely something added by the software architect in your project. I would guess that Datalayer and repositories are there to help out with implementing a layered architecture. Perhaps something like:

  • Datalayer (NHibernate or some other ORM or whatever)

  • Repositories (Classes used for CRUD stuff)

  • Application (Your MVC application, where controllers use repositories to fetch data, then put this data in the models, then sending the models to the views where the data is displayed)

Something like this, I guess, would be a typical way to use MVC3. Hope it helped :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜