ServiceFilterAttribute Classe

Definição

Um filtro que localiza outro filtro em um 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
Herança
ServiceFilterAttribute
Derivado
Atributos
Implementações

Comentários

Usado principalmente em FilterCollection.AddService chamadas.

Semelhante ao TypeFilterAttribute em que ambos usam injeção de construtor. Em vez disso, use TypeFilterAttribute se o filtro não for um serviço em si.

Construtores

ServiceFilterAttribute(Type)

Instancia uma nova ServiceFilterAttribute instância.

Propriedades

IsReusable

Obtém um valor que indica se o resultado de CreateInstance(IServiceProvider) pode ser reutilizado entre solicitações.

Order

Obtém o valor da ordem para determinar a ordem de execução de filtros. Os filtros são executados no valor numérico crescente da Order propriedade .

ServiceType

Obtém o Type do filtro a ser localizado.

Métodos

CreateInstance(IServiceProvider)

Cria uma instância do filtro executável.

Aplica-se a