How to structure my ASP.NET MVC 2 project with Areas sensibly
I want to structure my ASP.NET MVC 2 web application sensibly using Areas. The application consists of the two main parts Website
which is the default part and Dashboard
which administrates the site using a CMS. (Probably, more Areas will follow later on.)
How do I structure my project best? Should I ...
- create the Area
Dashboard
and put the stuff belonging to theWebsite
part into the main application folder or should I - create both Areas
Website
andDashboard
?
Additi开发者_运维问答onally, where should I place my Entity Data Model and the corresponding Repository classes that have to be accessed by both Areas?
I would go with option 1. Then your urls would look like this (if you use the default routing):
Website: http://mysite/ Dashboard: http://mysite/dashboard
If you change your mind later on, it's not too difficult to move your website into an area.
As for your "model", I wouldn't bother with the Models folders created by default for an MVC project. I would probably put this in its own project, give it a sensible namespace (mysite.domain or mysite.model) and reference it from the mvc app.
精彩评论