0

In .Net framework I use MiniProfiler for MySql connection command logging. In my current AspNetCore solution MiniProfiler doesn't show sql commands as well. What MiniProfiler options I should be using to log it?

Valery Yegorov
  • 171
  • 1
  • 11

2 Answers2

1

Thanks, It is not for Entity Framework, but solution is using MiniProfiler to profile MySQL Server. And the connection is wrap as following:

public DbConnection GetConnection()
{
    DbConnection connection = new System.Data.SqlClient.SqlConnection("...");
    return new StackExchange.Profiling.Data.ProfiledDbConnection(connection, MiniProfiler.Current);
}

But this does not help, as it does not capture actual SQL command with the parameter list. Please suggest if any additional options need to be configured.

usvd
  • 31
  • 2
0

If you're using Entity Framework Core, you need to:

  1. Install the MiniProfiler.EntityFrameworkCore NuGet package.
  2. In your Startup.cs, call AddEntityFramework():
public void ConfigureServices(IServiceCollection services)
{
    services.AddMiniProfiler()
            .AddEntityFramework();
}

Source: MiniProfiler documentation

Métoule
  • 13,062
  • 2
  • 56
  • 84