ServiceFilterAttribute Třída

Definice

Filtr, který najde jiný filtr v objektu 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
Dědičnost
ServiceFilterAttribute
Odvozené
Atributy
Implementuje

Poznámky

Primárně se používá při FilterCollection.AddService voláních.

Podobá se v tom, že oba používají injektáž konstruktoru TypeFilterAttribute . Místo toho použijte TypeFilterAttribute , pokud filtr sám o sobě není službou.

Konstruktory

ServiceFilterAttribute(Type)

Vytvoří instanci nové ServiceFilterAttribute instance.

Vlastnosti

IsReusable

Získá hodnotu, která označuje, zda lze výsledek CreateInstance(IServiceProvider) znovu použít napříč požadavky.

Order

Získá hodnotu pořadí pro určení pořadí provádění filtrů. Filtry se spouštějí ve vzestupné číselné hodnotě Order vlastnosti .

ServiceType

Type Získá filtr , který se má najít.

Metody

CreateInstance(IServiceProvider)

Vytvoří instanci spustitelného filtru.

Platí pro