<PackageReference Include="Known.SqlSugar" Version="1.0.7" />
// SqlSugar配置
builder.Services.AddKnownSqlSugar(config =>
{
config.DbType = DbType.SqlServer;
config.ConnectionString = builder.Configuration.GetSection("ConnString").Get<string>();
config.IsAutoCloseConnection = true;
config.MoreSettings ??= new ConnMoreSettings();
config.MoreSettings.IsAutoToUpper = false;
config.AopEvents ??= new AopEvents();
config.AopEvents.OnLogExecuting = (sql, pars) =>
{
var param = string.Join(",", pars.Select(p => $"{p.ParameterName}={p.Value}"));
Console.WriteLine($"SQL: {sql}, 参数: {param}");
};
});