Ejemplo n.º 1
0
        /// <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()));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        /// <summary>Disposes the Unity container when the application is shut down.</summary>
        public static void Shutdown()
        {
            var container = IoCConfig.GetConfiguredContainer();

            container.Dispose();
        }
Ejemplo n.º 4
0
        /// <summary>Integrates Unity when the application starts.</summary>
        public static void Start()
        {
            var resolver = new HierarchicalDependencyResolver(IoCConfig.GetConfiguredContainer());

            GlobalConfiguration.Configuration.DependencyResolver = resolver;
        }