예제 #1
0
        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            Stopwatch timer = Stopwatch.StartNew();

            await next();

            timer.Stop();
            actionTimes.Enqueue(timer.Elapsed.TotalMilliseconds);
            diagnostics.AddMessage($"Action time: { timer.Elapsed.TotalMilliseconds } Average: {actionTimes.Average():F2}");
        }
        public void OnActionExecuted(ActionExecutedContext context)
        {
            ViewResult vr;

            if ((vr = context.Result as ViewResult) != null)
            {
                diagnostics.AddMessage($"View name: {vr.ViewName}");
                diagnostics.AddMessage($"Model type: {vr.ViewData.Model.GetType().Name}");
            }
        }