It’s been an interesting few weeks since I came back from vacation. Found myself transferred to the Sitecore.Mvc project, something that in the past would have been considered a bit of a poison chalice. Not this time around. As a project we started by asking and listening to what the Sitecore development community were calling out for. As far as I know this is a first for my organisation, the feedback though is where it matters.
Model View Controller
It’s no secret that Microsoft has re-invented itself around engaging with the community since Scott Guthrie and others started to lift the covers on internal development activities. Microsoft went further than most commercial organisations are able to go, it open sourced a great swathe of its intellectual property and even opened it up to public pull requests via GIT.
Areas have been a part of ASP.NET MVC since ASP.NET MVC 2 shipped in 2010. This walkthrough article from MSDN sums up why areas are useful in MVC web applications. A brief extract follows:
To accommodate large projects, ASP.NET MVC lets you partition Web applications into smaller units that are referred to as areas. Areas provide a way to separate a large MVC Web application into smaller functional groupings. An area is effectively an MVC structure inside an application. An application could contain several MVC structures (areas).
For example, a single large e-commerce application might be divided into areas that represent the storefront, product reviews, user account administration, and the purchasing system. Each area represents a separate function of the overall application.
The release of Sitecore 6.6 saw the introduction of support for MVC and the Razor view engine within the Sitecore CMS. It wasn’t long before a question popped up on stackoverflow asking how to wire up a Sitecore Controller Rendering to a controller located within a MVC Area.
Hopefully this article will provide some answers for those wanting to use MVC Areas with Sitecore and highlight a few of the subtleties that currently may not be so well documented.
Doing the Simplest Thing