How to use GetCurrentAuditScope metthod in an ActionFilterAttribute

147 Views Asked by At

How to uses the GetCurrentAuditScope() (or another) method in an ActionFilterAtribbute on MVC and WebAPI to get the AuditScope.

I need recover that on OnActionExecuted(HttpActionExecutedContext actionExecutedContext) event.

Or have another thing which i can uses?

1

There are 1 best solutions below

6
On BEST ANSWER

Yes, you can use the GetCurrentAuditScope() Extension Method on HttpContext, for example:

using Audit.WebApi;
// ...

public override void OnActionExecuted(ActionExecutedContext context)
{
    var scope = context.HttpContext.GetCurrentAuditScope();
    // ...
}