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?
I would expect something like this:
public override void OnActionExecuting(HttpActionContext actionContext)
{
actionContext.SavedState = Precomputation();
}
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
var pre = actionExecutedContext.ActionContext.SavedState;
Postcomputation(pre);
}
but SavedState
doesn't actually exist, of course. What should I use instead?
Add items to actionContext.Request.Properties
as required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With