views:

71

answers:

0

What is the best way to create a bootstrapper for my MVC 2 app? I'm using Unity and AutoMapper and want to abstract the loading and configuration of them as much as possible.

A decent example is here (http://weblogs.asp.net/rashid/archive/2009/02/17/use-bootstrapper-in-your-asp-net-mvc-application-and-reduce-code-smell.aspx ), but UnityContainer implements IDisposable and in that example it is never cleaned up. This (http://stackoverflow.com/questions/1807298/configuring-automapper-in-bootstrapper-violates-open-closed-principle/1810728#1810728) is also a decent example, but he doesn't deal with the Unity/Disposable problem either.

Here's (http://www.dominicpettifer.co.uk/Blog/42/put-an-ioc-powered-bootstrapper-in-your-asp-net-mvc-application) another great example of how to do a Bootstrapper, but again doesn't address the Unity/Disposable issue.

I thought about keeping my Bootstrapper object around in a static variable and make it implement IDisposable, but that doesn't sound right.