ServiceFilterAttribute 类

定义

查找另一个 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
继承
ServiceFilterAttribute
属性
实现

注解

主要用于 FilterCollection.AddService 调用。

TypeFilterAttribute类似于这两者都使用构造函数注入。 如果筛选器本身不是服务,请改用 TypeFilterAttribute

构造函数

ServiceFilterAttribute(Type)

实例化新 ServiceFilterAttribute 实例。

属性

IsReusable

获取一个值,该值指示是否可以在请求之间重复使用结果 CreateInstance(IServiceProvider)

Order

获取用于确定筛选器执行顺序的顺序值。 筛选器以属性的 Order 升序数值执行。

ServiceType

获取 Type 要查找的筛选器。

方法

CreateInstance(IServiceProvider)

创建可执行筛选器的实例。

适用于