System.Web.Mvc.ActionFilterAttribute与System.Web.Http.Filters.ActionFilterAttribute [英] System.Web.Mvc.ActionFilterAttribute vs System.Web.Http.Filters.ActionFilterAttribute

查看:111
本文介绍了System.Web.Mvc.ActionFilterAttribute与System.Web.Http.Filters.ActionFilterAttribute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到有两个版本的ActionFilterAttribute类.
System.Web.Mvc.ActionFilterAttribute System.Web.Http.Filters.ActionFilterAttribute

i see that there are two version of ActionFilterAttribute class.
System.Web.Mvc.ActionFilterAttribute and System.Web.Http.Filters.ActionFilterAttribute

有什么不同?

推荐答案

System.Web.Mvc 一个用于以前的MVC版本.

The System.Web.Http one is for Web API; the System.Web.Mvc one is for previous MVC versions.

从源头上可以看到,Web API版本具有一些差异.

You can see from the source that the Web API version has several differences.

  • 它具有OnResultExecutingOnResultExecuted处理程序(由ASP.NET MVC框架在执行操作结果之前/之后调用." )
  • 可以异步执行
  • 不是允许您指定执行顺序
  • It has OnResultExecuting and OnResultExecuted handlers ("Called by the ASP.NET MVC framework before/after the action result executes.")
  • It can be executed asynchronously
  • It does not let you specify an order of execution

这篇关于System.Web.Mvc.ActionFilterAttribute与System.Web.Http.Filters.ActionFilterAttribute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆