Example #1
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var auditData = StudioXAuditFilterData.GetOrNull(filterContext.HttpContext);

            if (auditData == null)
            {
                return;
            }

            auditData.Stopwatch.Stop();

            auditData.AuditInfo.ExecutionDuration = Convert.ToInt32(auditData.Stopwatch.Elapsed.TotalMilliseconds);
            auditData.AuditInfo.Exception         = filterContext.Exception;

            auditingHelper.Save(auditData.AuditInfo);
        }
Example #2
0
        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!ShouldSaveAudit(filterContext))
            {
                StudioXAuditFilterData.Set(filterContext.HttpContext, null);
                return;
            }

            var auditInfo = auditingHelper.CreateAuditInfo(
                filterContext.ActionDescriptor.GetMethodInfoOrNull(),
                filterContext.ActionParameters
                );

            var actionStopwatch = Stopwatch.StartNew();

            StudioXAuditFilterData.Set(
                filterContext.HttpContext,
                new StudioXAuditFilterData(
                    actionStopwatch,
                    auditInfo
                    )
                );
        }
Example #3
0
 public static void Set(HttpContextBase httpContext, StudioXAuditFilterData auditFilterData)
 {
     GetAuditDataStack(httpContext).Push(auditFilterData);
 }