简体   繁体   English

ActionFilter 和 ResultFilter 的不同和例子

[英]ActionFilter and ResultFilter different and Examples

I can't understanding the difference between ActionFilter and ResultFilter.我无法理解 ActionFilter 和 ResultFilter 之间的区别。 ResultFilter after execution OnActionExecuted method. ResultFilter 执行 OnActionExecuted 方法后。 Could you please explain the main different and example about the ActionFilter and ResultFilter.您能否解释一下 ActionFilter 和 ResultFilter 的主要区别和示例。

Thanks $ Regards, Manikandan M.谢谢 $ 问候, Manikandan M。

See flow below:请参阅下面的流程:

在此处输入图片说明

ActionFilter can be used for additional manipulations on action arguments and results. ActionFilter 可用于对操作参数和结果进行额外操作。 ResultFilter is processed only if an action was executed with success, and can be used, for example, to modify results which have to be displayed. ResultFilter 仅在操作成功执行时才被处理,例如,可用于修改必须显示的结果。

Examples you can find here: https://docs.microsoft.com/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1您可以在此处找到示例: https : //docs.microsoft.com/aspnet/core/mvc/controllers/filters?view=aspnetcore-3.1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM