Inheritance: System.Web.Mvc.FilterAttributeFilterProvider
Beispiel #1
0
        /// <summary>Replaces default Filter Providers with instance of <see cref="DryIocFilterAttributeFilterProvider"/>,
        /// add in addition registers aggregated filter to container..</summary>
        /// <param name="container">Container to register to.</param>
        /// <param name="filterProviders">Original filter providers.</param>
        public static void SetFilterAttributeFilterProvider(this IContainer container, Collection <IFilterProvider> filterProviders = null)
        {
            filterProviders = filterProviders ?? FilterProviders.Providers;
            var filterProvidersSnapshot = filterProviders.OfType <FilterAttributeFilterProvider>().ToArray();

            foreach (var provider in filterProvidersSnapshot)
            {
                filterProviders.Remove(provider);
            }

            var filterProvider = new DryIocFilterAttributeFilterProvider(container);

            filterProviders.Add(filterProvider);

            container.UseInstance <IFilterProvider>(filterProvider);
        }
        /// <summary>Replaces default Filter Providers with instance of <see cref="DryIocFilterAttributeFilterProvider"/>,
        /// add in addition registers aggregated filter to container..</summary>
        /// <param name="container">Container to register to.</param>
        /// <param name="filterProviders">Original filter providers.</param>
        public static void SetFilterAttributeFilterProvider(this IContainer container, Collection <IFilterProvider> filterProviders = null)
        {
            filterProviders = filterProviders ?? FilterProviders.Providers;

            var filterAttributeFilterProviders = filterProviders.OfType <FilterAttributeFilterProvider>().ToArray();

            for (var i = filterAttributeFilterProviders.Length - 1; i >= 0; --i)
            {
                filterProviders.RemoveAt(i);
            }

            var filterProvider = new DryIocFilterAttributeFilterProvider(container);

            filterProviders.Add(filterProvider);

            container.RegisterInstance <IFilterProvider>(filterProvider);
        }
Beispiel #3
0
        /// <summary>Replaces default Filter Providers with instance of <see cref="DryIocFilterAttributeFilterProvider"/>,
        /// add in addition registers aggregated filter to container..</summary>
        /// <param name="container">Container to register to.</param>
        /// <param name="filterProviders">Original filter providers.</param>
        public static void SetFilterAttributeFilterProvider(this IContainer container, Collection<IFilterProvider> filterProviders = null)
        {
            filterProviders = filterProviders ?? FilterProviders.Providers;

            var filterAttributeFilterProviders = filterProviders.OfType<FilterAttributeFilterProvider>().ToArray();
            for (var i = filterAttributeFilterProviders.Length - 1; i >= 0; --i)
                filterProviders.RemoveAt(i);

            var filterProvider = new DryIocFilterAttributeFilterProvider(container);
            filterProviders.Add(filterProvider);

            container.RegisterInstance<IFilterProvider>(filterProvider);
        }