查看 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) );
效果: