public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            base.OnActionExecuted(filterContext);
            var context = new MvcOperationContext(filterContext, "action");

            TryFinishMvcOperation(context);
        }
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            base.OnResultExecuted(filterContext);
            var context = new MvcOperationContext(filterContext, "result");

            TryFinishMvcOperation(context);
        }
        public override void OnResultExecuting(ResultExecutingContext filterContext)
        {
            var context = new MvcOperationContext(filterContext, "result");

            StartMvcOperation(context);
            base.OnResultExecuting(filterContext);
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var context = new MvcOperationContext(filterContext, "action");

            StartMvcOperation(context);
            base.OnActionExecuting(filterContext);
        }
        protected IOperationScope StartMvcOperation(MvcOperationContext context)
        {
            var scope = Op.Start(context.GetOperationName(), Op.Context(context.ToDictionary()));

            if (ActionToOperationMapKeeper.HasContext)
            {
                ActionToOperationMap[context.GetOperationKey()] = scope;
            }
            return(scope);
        }
        protected void TryFinishMvcOperation(MvcOperationContext context)
        {
            if (!ActionToOperationMapKeeper.HasContext)
            {
                return;
            }

            IOperationScope scope;

            if (!ActionToOperationMap.TryGetValue(context.GetOperationKey(), out scope))
            {
                OperationsLog.WriteLine(() => "DBG: no active mvc operation to finish");
            }
            else
            {
                scope.Dispose();
            }
        }