/// <summary>Integrates Autofac when the application starts.</summary> public static void Start() { _container = IoCConfig.GetMvcConfiguredContainer(); FilterProviders.Providers.Remove(FilterProviders.Providers.OfType <FilterAttributeFilterProvider>().First()); FilterProviders.Providers.Add(new AutofacFilterProvider()); DependencyResolver.SetResolver(new AutofacDependencyResolver(_container.GetAutofacContainer())); }
public static void Start() { _container = IoCConfig.GetMvcConfiguredContainer(); FilterProviders.Providers.Remove(FilterProviders.Providers.OfType <FilterAttributeFilterProvider>().First()); FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(_container.GetUnityContainer())); DependencyResolver.SetResolver(new IFramework.Unity.Mvc.UnityDependencyResolver(_container)); // TODO: Uncomment if you want to use 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 = IoCConfig.GetConfiguredContainer(); container.Dispose(); }
/// <summary>Integrates Unity when the application starts.</summary> public static void Start() { var resolver = new HierarchicalDependencyResolver(IoCConfig.GetConfiguredContainer()); GlobalConfiguration.Configuration.DependencyResolver = resolver; }