TypeFilterAttribute 类

定义

一个筛选器,用于创建类型的 ImplementationType另一个筛选器,从依赖项注入中检索缺少的构造函数参数(如果有)。

public ref class TypeFilterAttribute : 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 TypeFilterAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IFilterFactory, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type TypeFilterAttribute = class
    inherit Attribute
    interface IFilterFactory
    interface IFilterMetadata
    interface IOrderedFilter
Public Class TypeFilterAttribute
Inherits Attribute
Implements IFilterFactory, IOrderedFilter
继承
TypeFilterAttribute
派生
属性
实现

注解

主要用于调用。FilterCollection.Add

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

构造函数

TypeFilterAttribute(Type)

实例化新 TypeFilterAttribute 实例。

属性

Arguments

获取或设置要传递给 ImplementationType 构造函数的非服务参数。

ImplementationType

Type获取要创建的筛选器的 。

IsReusable

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

Order

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

方法

CreateInstance(IServiceProvider)

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

适用于