Aracılığıyla paylaş


ActionFilterAttribute Sınıf

Tanım

Eylemin ve eylem sonucunun yürütülmesini zaman uyumsuz olarak çevreleyen soyut bir filtre. Alt sınıflar, OnActionExecuted(ActionExecutedContext) diğer iki öğeden birini geçersiz kılmalı veya OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate) geçersiz kılmamalıdırOnActionExecuting(ActionExecutingContext), ancak geçersiz kılmamalıdırOnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate). Benzer şekilde alt sınıflar, OnResultExecuted(ResultExecutedContext) diğer ikisini geçersiz kılmalı, OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate) ancak geçersiz kılmamalıdırOnResultExecuting(ResultExecutingContext)OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate).

public ref class ActionFilterAttribute abstract : Attribute, Microsoft::AspNetCore::Mvc::Filters::IActionFilter, Microsoft::AspNetCore::Mvc::Filters::IAsyncActionFilter, Microsoft::AspNetCore::Mvc::Filters::IAsyncResultFilter, Microsoft::AspNetCore::Mvc::Filters::IOrderedFilter, Microsoft::AspNetCore::Mvc::Filters::IResultFilter
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)]
public abstract class ActionFilterAttribute : Attribute, Microsoft.AspNetCore.Mvc.Filters.IActionFilter, Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter, Microsoft.AspNetCore.Mvc.Filters.IAsyncResultFilter, Microsoft.AspNetCore.Mvc.Filters.IOrderedFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type ActionFilterAttribute = class
    inherit Attribute
    interface IActionFilter
    interface IFilterMetadata
    interface IAsyncActionFilter
    interface IResultFilter
    interface IAsyncResultFilter
    interface IOrderedFilter
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method, AllowMultiple=true, Inherited=true)>]
type ActionFilterAttribute = class
    inherit Attribute
    interface IActionFilter
    interface IFilterMetadata
    interface IAsyncActionFilter
    interface IAsyncResultFilter
    interface IOrderedFilter
    interface IResultFilter
Public MustInherit Class ActionFilterAttribute
Inherits Attribute
Implements IActionFilter, IAsyncActionFilter, IAsyncResultFilter, IOrderedFilter, IResultFilter
Devralma
ActionFilterAttribute
Öznitelikler
Uygulamalar

Oluşturucular

ActionFilterAttribute()

Eylemin ve eylem sonucunun yürütülmesini zaman uyumsuz olarak çevreleyen soyut bir filtre. Alt sınıflar, OnActionExecuted(ActionExecutedContext) diğer iki öğeden birini geçersiz kılmalı veya OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate) geçersiz kılmamalıdırOnActionExecuting(ActionExecutingContext), ancak geçersiz kılmamalıdırOnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate). Benzer şekilde alt sınıflar, OnResultExecuted(ResultExecutedContext) diğer ikisini geçersiz kılmalı, OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate) ancak geçersiz kılmamalıdırOnResultExecuting(ResultExecutingContext)OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate).

Özellikler

Order

Filtrelerin yürütülmesinin sırasını belirlemek için sipariş değerini alır. Filtreler özelliğin artan sayısal değerinde Order yürütülür.

Yöntemler

OnActionExecuted(ActionExecutedContext)

Eylem yürütülürken, eylem sonucundan önce çağrılır.

OnActionExecuting(ActionExecutingContext)

Eylem yürütülmeden önce, model bağlaması tamamlandıktan sonra çağrılır.

OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate)

Model bağlama tamamlandıktan sonra eylemden önce zaman uyumsuz olarak çağrılır.

OnResultExecuted(ResultExecutedContext)

Eylem sonucu yürütülürken çağrılır.

OnResultExecuting(ResultExecutingContext)

Eylem sonucu yürütülmeden önce çağrılır.

OnResultExecutionAsync(ResultExecutingContext, ResultExecutionDelegate)

Eylem sonucundan önce zaman uyumsuz olarak çağrılır.

Şunlara uygulanır