IOrderedFilter.Order Property

Definition

Gets the order value for determining the order of execution of filters. Filters execute in ascending numeric value of the Order property.

public:
 property int Order { int get(); };
public int Order { get; }
member this.Order : int
Public ReadOnly Property Order As Integer

Property Value

Remarks

Filters are executed in an ordering determined by an ascending sort of the Order property.

Asynchronous filters, such as IAsyncActionFilter, surround the execution of subsequent filters of the same filter kind. An asynchronous filter with a lower numeric Order value will have its filter method, such as OnActionExecutionAsync(ActionExecutingContext, ActionExecutionDelegate), executed before that of a filter with a higher value of Order.

Synchronous filters, such as IActionFilter, have a before-method, such as OnActionExecuting(ActionExecutingContext), and an after-method, such as OnActionExecuted(ActionExecutedContext). A synchronous filter with a lower numeric Order value will have its before-method executed before that of a filter with a higher value of Order. During the after-stage of the filter, a synchronous filter with a lower numeric Order value will have its after-method executed after that of a filter with a higher value of Order.

If two filters have the same numeric value of Order, then their relative execution order is determined by the filter scope.

Applies to