48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
|
using Kurisu.AspNetCore.Startup;
|
|
using SqlSugar;
|
|
|
|
namespace Dlhis.Sys;
|
|
|
|
public class SqlSugarPack : BaseAppPack
|
|
{
|
|
public override void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddSqlSugar(sp =>
|
|
{
|
|
var configuration = sp.GetService<IConfiguration>();
|
|
|
|
return new List<ConnectionConfig>
|
|
{
|
|
new()
|
|
{
|
|
ConfigId = "identity",
|
|
|
|
ConnectionString = configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value,
|
|
DbType = DbType.MySqlConnector,
|
|
InitKeyType = InitKeyType.Attribute,
|
|
IsAutoCloseConnection = true,
|
|
|
|
MoreSettings = new ConnMoreSettings
|
|
{
|
|
DisableNvarchar = true,
|
|
}
|
|
},
|
|
new()
|
|
{
|
|
ConfigId = "default",
|
|
|
|
ConnectionString = configuration.GetSection("SqlSugarOptions:DefaultConnectionString").Value,
|
|
DbType = DbType.MySqlConnector,
|
|
InitKeyType = InitKeyType.Attribute,
|
|
IsAutoCloseConnection = true,
|
|
|
|
MoreSettings = new ConnMoreSettings
|
|
{
|
|
DisableNvarchar = true,
|
|
}
|
|
}
|
|
};
|
|
});
|
|
}
|
|
} |