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)

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

适用于