ASP.Net MVC Portable Area – Part 4 IoC framework support.

This is a multi post series on ASP.Net MVC Portable Areas

Using an Inversion of Control Container is a common scenario that would be needed by a Message Handler.  The Bus has an extensibility point to create the handlers. The model for this should feel similar to the ControllerFactory extension point in the ASP.Net MVC framework.  The sample below shows how to create a Message Handler factory for the StructureMap framework.




The SetMessageHandlerFactory method should be called once at application startup.   Other than that … this is a pretty simple way to add a Dependency Injection Framework support to the Portable Area infrastructure.


This makes it pretty simple for your message handlers to use constructor injection to manage their dependencies.

ASP.Net MVC Portable Areas – Part 3