Fixes filter order (#20073)

* fix url

* fix order
pull/20096/head
Guilherme Oenning 2020-10-02 22:21:23 +01:00 committed by GitHub
parent 99a534caed
commit 7a4872495b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -205,7 +205,7 @@ The `TestController`:
<!-- test via webBuilder.UseStartup<Startup>(); -->
Navigating to `https://localhost:5001/Test2/FilterTest2` runs the following code:
Navigating to `https://localhost:5001/Test/FilterTest2` runs the following code:
* `TestController.OnActionExecuting`
* `MySampleActionFilter.OnActionExecuting`
@ -244,8 +244,8 @@ The 3 filters run in the following order:
* `MySampleActionFilter.OnActionExecuting`
* `MyAction2FilterAttribute.OnActionExecuting`
* `Test2Controller.FilterTest2`
* `MySampleActionFilter.OnActionExecuted`
* `MyAction2FilterAttribute.OnResultExecuting`
* `MyAction2FilterAttribute.OnResultExecuting`
* `MySampleActionFilter.OnActionExecuted`
* `Test2Controller.OnActionExecuted`
The `Order` property overrides scope when determining the order in which filters run. Filters are sorted first by order, then scope is used to break ties. All of the built-in filters implement `IOrderedFilter` and set the default `Order` value to 0. As mentioned previously, controller level filters set the [Order](https://github.com/dotnet/AspNetCore/blob/master/src/Mvc/Mvc.Core/src/Filters/ControllerActionFilter.cs#L15-L17) property to `int.MinValue` For built-in filters, scope determines order unless `Order` is set to a non-zero value.