Sitecore 8.1 Now Supports MVC Areas
Model View Controller (MVC) “Areas” represent a handy module-based way to separate and manage different aspects of a website’s development. As you may know, the concept of “Areas” has been an integral part of ASP.NET MVC ever since ASP.NET MVC 2 launched in 2010. However, Sitecore has not offered an easy-and-comprehensive way to support MVC Areas—until now.
When Sitecore 8.1 officially launched in October 2015, it brought a host of new features that have simplified everything. With these new tools, developers no longer need to spend their time creating custom frameworks and writing custom rules to address MVC Areas. Instead, they have a much faster (and more streamlined) process, which ultimately speeds development time.
Along with default implementations, Sitecore 8.1 now provides a way for users to define their own Area resolver by implementing the “IAreaResolveStrategy” interface. This interface introduces two new concepts.
The first is a new processor called “ResolveArea,” now available in the Sitecore.Mvc.config file for resolving Areas. Within this processor configuration, various configurable area-resolving strategies are available to help users resolve an Area for current rendering. The call to a strategy is made serially, one after the other, until the currently called strategy resolves the area.
The default strategy used is ChainedAreaResolveStrategy, another new concept. This assists in configuring multiple resolvers, which are called in a chain. If there is only one resolver, this strategy can be changed.
Three Ways Sitecore 8.1 Can Resolve MVC Areas
Not only do they provide additional support to MVC Areas, they can be used in three ways to identify and resolve an area:
- Resolve by rendering a definition item – In rendering a definition item, the area of the Controller/View can be configured with one limitation—that the Controller field should either contain the unique Controller name or the fully qualified name of the Controller class.
- Resolve by rendering parameters – While adding a rendering to the presentation of an item (either statically or dynamically bound), a rendering parameter area can be added to rendering.
- Resolve by layout definition – Apart from the rendering definition items, the layout definition items also got a new Area field. This strategy takes the area from the layout attached to the current item. This reflects that each rendering of the current item takes the same area, as long as no other strategy has ever resolved that area.
If these strategies aren’t required, they can be removed from the configuration.
Explore Additional Resources
Learn how you can select the best Digital Experience platform for your business.
Our Certified Sitecore Experience Platform and Sitecore MVP’s specialize in helping you deliver seamless contextually personalized customer experiences.
GET HELP FROM OUR EXPERTS
Over the past 19 years, we have completed thousands of digital projects globally. We have one of the largest and deepest multi-solutions digital consulting teams in the world. Our proprietary processes and years of Digital Experience expertise have earned us a 97% customer satisfaction rating with our clients ranging from Global Fortune 1000 to Mid-Market Enterprises, leading educational institutions, and Non-Profits.
Contact us today for help if your organization needs assistance using Sitecore 8.1 features to the fullest.
About TA Digital
TA Digital is an innovative digital transformation agency, specializing in delivering the digital experience, commerce, and marketing solutions. For nearly two decades, we have been helping traditional businesses transform and create dynamic digital cultures through disruptive strategies and agile deployment of innovative solutions.