/// <summary> /// Adds Esquio profiling for MiniProfiler via DiagnosticListener. /// </summary> /// <typeparam name="T">The specific options type to chain with.</typeparam> /// <param name="options">The <see cref="MiniProfilerBaseOptions" /> to register on (just for chaining).</param> /// <exception cref="ArgumentNullException"><paramref name="options"/> is <c>null</c>.</exception> public static T AddEsquio <T>(this T options) where T : MiniProfilerBaseOptions { var initializer = new DiagnosticInitializer(new[] { new EsquioDiagnosticListener() }); initializer.Start(); return(options); }
public Startup(IConfiguration configuration) { Configuration = configuration; //MiniProfiler.EntityFrameworkCore var initializer = new DiagnosticInitializer(new[] { new RelationalDiagnosticListener() }); initializer.Start(); }
/// <summary> /// Adds middleware for profiling HTTP requests. /// </summary> /// <param name="builder">The <see cref="IApplicationBuilder"/> instance this method extends.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="builder"/> is null.</exception> public static IApplicationBuilder UseMiniProfiler(this IApplicationBuilder builder) { _ = builder ?? throw new ArgumentNullException(nameof(builder)); // Register all IMiniProfilerDiagnosticListeners that were registered, e.g. EntityFramework var listeners = builder.ApplicationServices.GetServices <IMiniProfilerDiagnosticListener>(); var initializer = new DiagnosticInitializer(listeners); initializer.Start(); return(builder.UseMiddleware <MiniProfilerMiddleware>()); }