MiniProfiler in ASP.NET Core
To install
dotnet add package MiniProfiler.AspNetCore.Mvc
dotnet add package MiniProfiler.EntityFrameworkCoreTo configurepublic 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-indexTo profile methods in a class libray, add this nuget package MiniProfiler.AspNetCoreWrap the piece of code like thisusing (MiniProfiler.Current.Step("InsertUpdateBillAsync"))
{
.....
}To wrap a single lineawait MiniProfiler.Current.Inline(async () => await ProcessCommitteeAsync(bill.committee), "ProcessCommitteeAsync");
Comments
Post a Comment