Registers a IFilterProvider that allows filter attributes to go through the
Simple Injector pipeline (https://simpleinjector.org/pipel). This allows any registered property to be
injected if a custom IPropertySelectionBehavior in configured in the container, and
allows anyinitializers to be called on those
attributes.
Please note that attributes are cached by MVC, so only dependencies should be injected that
have the singleton lifestyle.
Namespace: SimpleInjector
Assembly: SimpleInjector.Integration.Web.Mvc (in SimpleInjector.Integration.Web.Mvc.dll) Version: 4.10.2
Syntax
Parameters
- container
- Type: SimpleInjectorContainer
The container that should be used for injecting properties into attributes that the MVC framework uses.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type Container. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when the container is a null reference. |
InvalidOperationException | Thrown when a MVC filter provider has already been registered for a different container. |
See Also