static FilterProviders() { Providers = new FilterProviderCollection(); Providers.Add(GlobalFilters.Filters); Providers.Add(new FilterAttributeFilterProvider()); Providers.Add(new ControllerInstanceFilterProvider()); }
static FilterProviders() { Providers = new FilterProviderCollection(); Providers.Add(GlobalFilters.Filters); Providers.Add(new FilterAttributeFilterProvider()); Providers.Add(new ControllerInstanceFilterProvider()); }
public static void RegisterFilterProviders(FilterProviderCollection providers) { // http://blogs.microsoft.co.il/blogs/oric/archive/2011/10/28/exclude-a-filter.aspx IFilterProvider[] currentProviders = providers.ToArray(); providers.Clear(); providers.Add(new ExcludeFiltersProvider(currentProviders)); }
public MvcApplication(IControllerFactory controllerFactory, IContentProvider contentProvider, RouteCollection routes) { if (controllerFactory == null) { throw new ArgumentNullException("controllerFactory"); } if (contentProvider == null) { throw new ArgumentNullException("contentProvider"); } ControllerFactory = controllerFactory; ContentProvider = contentProvider; Routes = routes; ViewEngines = new ViewEngineCollection() { new RazorViewEngineSimulator(this) }; Bundles = new BundleCollection(); FilterProviders = new FilterProviderCollection(); foreach (var provider in System.Web.Mvc.FilterProviders.Providers) { FilterProviders.Add(provider); } ModelMetadataProvider = ModelMetadataProviders.Current; WebViewPageFactory = new WebViewPageFactory(Assemblies, GetNamespaces(this)); Binders = new ModelBinderDictionary(); foreach (var b in ModelBinders.Binders) { Binders.Add(b); } }
public static void RegisterFilters(FilterProviderCollection filterProviderCollection) { GlobalConfiguration.Configuration.Services.Replace( typeof(IHttpControllerActivator), new UnityControllerActivator(UnityContainer.Instance)); filterProviderCollection.Add(new UnityFilterAttributeFilterProvider(UnityContainer.Instance)); }
/// <summary> /// Builds and registers the provider as a global filter provider /// </summary> /// <param name="filters"></param> /// <param name="removeGlobal">True to remove the implicit GlobalFilters provider</param> public void RegisterProvider(FilterProviderCollection filters, bool removeGlobal = false) { if (removeGlobal) { filters.RemoveAll(d => d.GetType() == typeof(GlobalFilterCollection)); } filters.Add(BuildProvider()); }
/// <summary> /// Replace the default filter attribute filter provider with an instance /// of this type. /// </summary> /// <param name="filterProviders">The global filter provider collection.</param> public static void Install(FilterProviderCollection filterProviders) { if (filterProviders == null) throw new ArgumentNullException("filterProviders"); var existing = filterProviders.OfType<FilterAttributeFilterProvider>().SingleOrDefault(); if (existing != null) filterProviders.Remove(existing); filterProviders.Add(new ImportCapableFilterAttributeFilterProvider()); }
public static void RegisterFilterProviders(FilterProviderCollection providers) { // Remove the old provider since we do not want dubplicates providers.Remove <FilterAttributeFilterProvider>(); // Create the IKernel and register the services var kernel = new StandardKernel(); kernel.Bind <IMessageService>().To <MessageService>(); // Register the provider with the MVC3 runtime providers.Add(new InjectableFilterProvider(kernel)); }
public static IWindsorContainer InstallMvcFilterProvider( [NotNull] this FilterProviderCollection filterProviders, [NotNull] IWindsorContainer container, [CanBeNull] TypePropertyDescriptorCache propertyDescriptorCache) { if (filterProviders == null) { throw new ArgumentNullException(nameof(filterProviders)); } if (container == null) { throw new ArgumentNullException(nameof(container)); } var attributeFilterProviders = filterProviders.OfType <FilterAttributeFilterProvider>().ToArray(); foreach (var attributeFilterProvider in attributeFilterProviders) { filterProviders.Remove(attributeFilterProvider); } filterProviders.Add(new WindsorFilterAttributeProvider(container, propertyDescriptorCache)); return(container); }
public void RegisterFilterProviders(FilterProviderCollection providers) { providers.Remove<FilterAttributeFilterProvider>(); providers.Add(new WindsorFilterProvider(Container)); }
/// <summary> /// Replace the default filter attribute filter provider with an instance /// of this type. /// </summary> /// <param name="filterProviders">The global filter provider collection.</param> public static void Install(FilterProviderCollection filterProviders) { if (filterProviders == null) throw new ArgumentNullException("filterProviders"); filterProviders.Add(new CompositionFilterProvider()); }
private void InitDefaultFilterProviders() { _filterProviders.Add(new AttributedFilterProvider(true)); _filterProviders.Add(new ControllerFilterProvider()); }
public static void RegisterGlobalFilters(FilterProviderCollection filterProviders, GlobalFilterCollection filters, IContainer container) { filterProviders.Add(new AntiForgeryTokenFilterProvider()); filters.Add(new ApplicationInsightsHandleErrorAttribute()); }