我有一个 ActionFilterAttribute ,做一些东西,之前和目标的行动之后。我想保存执行
呼叫的状态在已执行
通话使用 - 但这里我要救这个数据?
I have an ActionFilterAttribute which does some stuff both before and after the target action. I would like to save the state of the Executing
call for use in the Executed
call - but where should I save this data?
我希望是这样的:
public override void OnActionExecuting(HttpActionContext actionContext)
{
actionContext.SavedState = Precomputation();
}
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
var pre = actionExecutedContext.ActionContext.SavedState;
Postcomputation(pre);
}
但 SavedState
实际上不存在的,当然。我应该用什么代替呢?
but SavedState
doesn't actually exist, of course. What should I use instead?
将项目添加到 actionContext.Request.Properties
的要求。