ServiceFilterAttribute Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Filtre qui recherche un autre filtre dans un 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
- Héritage
-
ServiceFilterAttribute
- Dérivé
- Attributs
- Implémente
Remarques
Principalement utilisé dans les FilterCollection.AddService appels.
Semblable au TypeFilterAttribute dans, les deux utilisent l’injection de constructeur. Utilisez TypeFilterAttribute plutôt si le filtre n’est pas lui-même un service.
Constructeurs
ServiceFilterAttribute(Type) |
Instancie une nouvelle ServiceFilterAttribute instance. |
Propriétés
IsReusable |
Obtient une valeur qui indique si le résultat de CreateInstance(IServiceProvider) peut être réutilisé entre les requêtes. |
Order |
Obtient la valeur d’ordre pour déterminer l’ordre d’exécution des filtres. Les filtres s’exécutent dans la valeur numérique croissante de la Order propriété. |
ServiceType |
Obtient le Type de filtre à rechercher. |
Méthodes
CreateInstance(IServiceProvider) |
Crée une instance du filtre exécutable. |