插件详情
By 清风大侠

Known.SqlSugar

ORM免费
Known框架数据访问支持SqlSugar的类库。
  • 引用包
<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}");
    };
});