Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(UnityActivator), "Start")]
- [assembly: WebActivatorEx.ApplicationShutdownMethod(typeof(UnityActivator), "Shutdown")]
- /// <summary>Provides the bootstrapping for integrating Unity when it is hosted in ASP.NET</summary>
- public static class UnityActivator
- {
- /// <summary>Integrates Unity when the application starts.</summary>
- public static void Start()
- {
- // This is required if you intend to use the PerRequestLifetimeManager
- Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(UnityPerRequestHttpModule));
- }
- /// <summary>Disposes the Unity container when the application is shut down.</summary>
- public static void Shutdown()
- {
- var container = UnityConfig.GetConfiguredContainer();
- container.Dispose();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement