查看 EF Core 的执行sql

 

编辑 appsettings.json

"Logging": {
  "LogLevel": {
    "Default": "Information",
    "Microsoft": "Warning",
    "Microsoft.Hosting.Lifetime": "Information",
    "Microsoft.EntityFrameworkCore.Database.Command": "Information" //主要代码
  }
}

 

编辑 Startup.cs

//EF Core DbContext类
var connectionString = EncryptHelper.DecryptAES(Configuration.GetConnectionString("DBConnection"), "CDLZ20200610soft");
ServerVersion serverVersion = ServerVersion.AutoDetect(connectionString);
services.AddDbContextPool<AppDbContext>(
        options => options
        .EnableSensitiveDataLogging(true)   //主要代码
        .UseMySql(connectionString, serverVersion)
    );

 

效果:

 

 

 

posted @ 2021-09-24 16:56  kueizheng  阅读(185)  评论(0编辑  收藏  举报