MiniProfiler in ASP.NET Core

 To install

dotnet add package MiniProfiler.AspNetCore.Mvc
dotnet add package MiniProfiler.EntityFrameworkCore
To configure
public void ConfigureServices(IServiceCollection services)
{
....
    services.AddMiniProfiler(options => options.RouteBasePath = "/profiler").AddEntityFramework();
....
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    app.UseMiniProfiler();
    /* Code removed for brevity. */
}
To access a list of all requests, navigate to
/profiler/results-index
To profile methods in a class libray, add this nuget package
MiniProfiler.AspNetCore
Wrap the piece of code like this
using (MiniProfiler.Current.Step("InsertUpdateBillAsync"))
{
.....
}
To wrap a single line
await MiniProfiler.Current.Inline(async () => await ProcessCommitteeAsync(bill.committee), "ProcessCommitteeAsync");

Comments

Popular posts from this blog

Adding CKEditor 4 to Angular

Using @CurrentIteration with TFS API