public MiniProfiler Start(string profilerName, MiniProfilerBaseOptions options) { CurrentProfiler = new MiniProfiler(profilerName ?? "MiniProfiler", options); return(CurrentProfiler); }
/// <summary> /// Starts a new profiling session. /// </summary> /// <param name="profilerName">The name for the started <see cref="MiniProfiler"/>.</param> /// <param name="options">The options to use for this profiler, including all downstream commands.</param> public MiniProfiler Start(string profilerName, MiniProfilerBaseOptions options) => _profiler = new MiniProfiler(profilerName, options);
/// <summary> /// Saves the given <paramref name="options"/> as the global <see cref="DefaultOptions"/> available for use globally. /// These are intended to be used by global/background operations where normal context access isn't available. /// </summary> /// <typeparam name="T">The specific type of <see cref="MiniProfilerBaseOptions"/> to use.</typeparam> /// <param name="options">The options object 44to set for background access.</param> public static T Configure <T>(T options) where T : MiniProfilerBaseOptions { DefaultOptions = options ?? throw new ArgumentNullException(nameof(options)); options.Configure(); // Event handler of sorts return(options); }
/// <summary> /// Starts a new MiniProfiler and sets it to be current. By the end of this method /// <see cref="CurrentProfiler"/> should return the new MiniProfiler. /// </summary> /// <param name="profilerName"> /// Allows explicit naming of the new profiling session; when null, an appropriate default will be used, e.g. for /// a web request, the URL will be used for the overall session name. /// </param> /// <param name="options">The options to start the MiniPofiler with. Likely a more-specific type underneath.</param> public virtual MiniProfiler Start(string profilerName, MiniProfilerBaseOptions options) => CurrentProfiler = new MiniProfiler(profilerName ?? nameof(MiniProfiler), options);