Database http://img443.imageshack.us/img443/6049/structure.gif
This is database structure. It is used to build simple cms in asp.net mvc. Before I run deeper into developing site, I want to make sure if this would be "correct" web structure:
Articles:
- Controllers folder: Create controllers ArticleCategoryController and ArticleController
- Models folder: ArticleCategoryRepository and ArticleRepository
- View folder: ArticleCategory folder (Create.aspx, Edit.aspx, Index.aspx, Details.aspx); Article folder (Create.aspx, Edit.aspx, Index.aspx, Details.aspx)
Photos:
- Controllers folder: Create controllers PhotoAlbumController and PhotoController
- Models folder: PhotoAlbumRepository and PhotoRepository
- View folder: PhotoAlbum folder (Create.aspx, 开发者_高级运维Edit.aspx, Index.aspx, Details.aspx); Photo folder (Create.aspx, Edit.aspx, Index.aspx, Details.aspx)
and so on...
Is there a better way or this is ok? Thanks. IleThere are lots of ways to organize your controllers and views. I usually create a controller for each full view.
The main comment I have here is about the model. I do not like putting model code into the models folder of the mvc web project unless they are view models or somehow directly related to the web tier of my app and inapplicable to a non web context. In my opinion, you are better off putting things like domain classes, repositories services, etc in a separate assembly or group of assemblies. This way you can swap out the front end with silverlight, or some other technology and continue to leverage your core domain code. Not only is this beneficial for swapping out front ends which is sometimes rare, but you can use the core domain dll for batch files or command line utilities if you ever need to do batch type operations outside of the context of your website.
精彩评论