ServiceFilterAttribute Class

Definition

A filter that finds another filter in an IServiceProvider.

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

Remarks

Primarily used in FilterCollection.AddService calls.

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

Constructors

ServiceFilterAttribute(Type)

Instantiates a new ServiceFilterAttribute instance.

Properties

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.

ServiceType

Gets the Type of filter to find.

Methods

CreateInstance(IServiceProvider)

Creates an instance of the executable filter.

Applies to