Chapter 13. Organization with areas
This chapter covers
As ASP.NET MVC websites become larger and more complex, the number of controllers inevitably grows. With a large number of controllers, you’ll start to notice many controllers that might logically belong together as a group. You might have administration sections of your application, product catalog sections, customer-care sections, shopping cart and ordering sections, and so on. Each of these application areas will likely share nothing more than perhaps a common logon widget or a layout, but each application area probably has quite a lot of functionality in common with other controllers and views within that area.
To help tame large applications and organize site functionality, ASP.NET MVC 2 introduced the concept of areas. Areas allow you to segregate controllers, models, and views into different physical locations, with the area-specific pieces in a single area folder.
In the previous chapter, we tamed controller duplication by looking at extensibility points for individual controllers. In this chapter, we’ll examine using areas to separate our application’s different concerns. We’ll also use T4MVC templates to help us generate our URLs and links between areas.