コード例 #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()));
        }
コード例 #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));
        }