Register Areas

Mar 7, 2013 at 8:22 PM
Hello,

I'm working on a large MVC app that required my group to make plug-able areas something similar to this http://nileshhirapra.blogspot.sg/2012/02/aspnet-mvc-pluggable-application.html. Now I'm trying to make use of Munq in my MVC app to register the Areas and cant figure out what I need to do to register Areas.

I was looking at this article http://www.codeproject.com/Articles/43354/Using-Munq-IOC-with-ASP-NET-MVC-2-Preview-2 which states "Note: This version of the MunqControllerFactory does not support the Areas feature of MVC 2. This too will be corrected in a future article."

I guess the questions is how can I register an Area using Munq?

Thanks,
Kris
Coordinator
Mar 8, 2013 at 1:08 AM
The Munq.MVC3 package on Nuget adds Munq to your MVC3 or 4 application. Areas are handled correctly as the MVC framework asks the IOC container for a Class, not an instance, and Munq knows how to create classes without registering the classes in advance.

The first time it creates an instance of a Class, it uses Reflection to determine the Constructor with the most parameters, and then creates a delegate which uses this constructor, calling Munq.Resolve(Type type) for each of the parameters.

So, while I haven't tried this particular scenario, it should just work without any Registering of the Areas in Munq.