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) { return; } _diagnostics.AddMessage($"View name: {vr.ViewName}"); _diagnostics.AddMessage($"Model type: {vr.ViewData.Model.GetType().Name}"); }
public void OnActionExecuted(ActionExecutedContext context) { ViewResult responseViewResult; if ((responseViewResult = context.Result as ViewResult) != null) { var name = responseViewResult.ViewName ?? "Null"; diagnostics.AddMessage($"View name: {name}"); var result = responseViewResult.ViewData?.Model?.GetType().Name ?? "Null"; diagnostics.AddMessage($@"Model type: {result}"); } }