This is a multi post series on ASP.Net MVC Portable Areas
- Part 1 – Introduction
- Part 2 – Sample Portable Area
- Part 3 – Usage of a Portable Area
- Part 4 – IoC framework support
- Part 5 – Update for 2012 / 3 Years Later
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.
Post Footer automatically generated by Add Post Footer Plugin for wordpress.