TypeFilterAttribute Class

Definition

A filter that creates another filter of type ImplementationType, retrieving missing constructor arguments from dependency injection if available there.

public ref class TypeFilterAttribute : Attribute, Microsoft::AspNetCore::Mvc::Filters::IFilterFactory, Microsoft::AspNetCore::Mvc::Filters::IOrderedFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]
public class TypeFilterAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IFilterFactory, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type TypeFilterAttribute = class
    inherit Attribute
    interface IFilterFactory
    interface IFilterMetadata
    interface IOrderedFilter
Public Class TypeFilterAttribute
Inherits Attribute
Implements IFilterFactory, IOrderedFilter
Inheritance
TypeFilterAttribute
Derived
Attributes
Implements

Remarks

Primarily used in FilterCollection.Add calls.

Similar to the ServiceFilterAttribute in that both use constructor injection. Use ServiceFilterAttribute instead if the filter is itself a service.

Constructors

TypeFilterAttribute(Type)

Instantiates a new TypeFilterAttribute instance.

Properties

Arguments

Gets or sets the non-service arguments to pass to the ImplementationType constructor.

ImplementationType

Gets the Type of filter to create.

IsReusable

Gets a value that indicates if the result of CreateInstance(IServiceProvider) can be reused across requests.

Order

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

Methods

CreateInstance(IServiceProvider)

Creates an instance of the executable filter.

Applies to