How do I organize this ASP.NET MVC2 project?
I'm tasked with creating a portal-like application that will host a number of small apps. This is my first venture into MVC, and I'm having difficulty determining how best to organize the project to hand开发者_Go百科le the logical routing.
The routing pattern is:
{app}/{activity}/{controller}/{action}Examples:
OrderingSystem/Ordering/CurrentOrders/View Admin/Security/Users/Edit EducationSystem/EducationPlans/CurrentPlan/ViewAreas seem like a logical choice for the {app} level of routing, but from the look of things, they can't be nested. Do I just let my area controllers be a disorderly mixture of {activities} + {controllers}?
If that's the answer, how do I handle the routing? I'd prefer not to have my routing table mappings be too finely grained, but if the activity concept is going to share space with the controller concept I don't see how this is avoidable.
Alternatively, do I need to consider hosting these apps separately? That's certainly a viable option for this project, but it seems like an awful lot of trouble just to handle an extra layer of logical separation.
Anything in MVCContrib or other third party libraries that could help?
I figured this one out on my own, so I thought I'd share the solution with the community.
The short answer is, nested areas are supported/supportable by the ASP.NET MVC 2 framework, but not by the tools provided with Visual Studio 2010. As long as you are conforming to the file structure conventions and creating a AreaRegistration-derived class to handle the routing, MVC 2 will be perfectly happy to serve your views to the world. The catch is - you'll have to manually create all the infrastructure.
Give me some time, and I'll post some example code.
精彩评论