<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<PackageReference Include="Known.SqlSugar" Version="1.0.3" />
</ItemGroup>
</Project>
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}");
//Console.WriteLine($"参数: {param}");
};
});