在的WebAPI,我应该在哪里保存调用之间的数据,以我的ActionFilter?我的、数据、WebAPI、ActionFilter

由网友(发呆草)分享简介:我有一个 ActionFilterAttribute ,做一些东西,之前和目标的行动之后。我想保存执行呼叫的状态在已执行通话使用 - 但这里我要救这个数据?I have an ActionFilterAttribute which does some stuff both before and after the t...

我有一个 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 的要求。

阅读全文

相关推荐

最新文章