Esempio n. 1
0
        public static void RegisterTypes()
        {
            RegisterSpecifiedTypes();

            var container = new UnityContainer();
            UnityConfigurationSection configuration = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
            configuration.Configure(container);

            //Enabling Dependency Injection for filters
            var oldProvider = FilterProviders.Providers.Single(f => f is FilterAttributeFilterProvider);
            FilterProviders.Providers.Remove(oldProvider);
            var provider = new UnityFilterAttributeFilterProvider(container);
            FilterProviders.Providers.Add(provider);

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
        }
Esempio n. 2
0
        public static void RegisterTypes()
        {
            RegisterSpecifiedTypes();

            var container = new UnityContainer();
            UnityConfigurationSection configuration = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");

            configuration.Configure(container);

            //Enabling Dependency Injection for filters
            var oldProvider = FilterProviders.Providers.Single(f => f is FilterAttributeFilterProvider);

            FilterProviders.Providers.Remove(oldProvider);
            var provider = new UnityFilterAttributeFilterProvider(container);

            FilterProviders.Providers.Add(provider);

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));
        }