开发者

does a action filter override a controller filter?

开发者 https://www.devze.com 2023-01-14 09:08 出处:网络
does a action 开发者_StackOverflowfilter override a controller filter?A filter applied to a controller is just shorthand for applying it to every action method.

does a action 开发者_StackOverflowfilter override a controller filter?


A filter applied to a controller is just shorthand for applying it to every action method.

So filters in general do not override each other. You can order the filters such that one filter runs after another and reverses the change made by the other one, but in general this is not a good idea.

It's best to write your filters such that they are unaware of each other as much as possible. Having the filters interact with each other is a recipe for adding unnecessary complexity and a source of bugs.

Filters in general should be cross-cutting concerns.


Considering that they are attributes applied on different targets (class and method) it depends entirely on implementation of the filter. If you don't use any custom logic both should be applied one after the other I think.

0

精彩评论

暂无评论...
验证码 换一张
取 消