fix DbType

This commit is contained in:
2024-04-02 10:10:42 +08:00
parent 2ce5b1aaac
commit 2b42eb248b
4 changed files with 29 additions and 7 deletions

View File

@@ -24,7 +24,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "face",
ConnectionString = configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
@@ -38,7 +38,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "log",
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,

View File

@@ -1,5 +1,6 @@
using Kurisu.AspNetCore.Startup;
using Kurisu.SqlSugar.Extensions;
using SqlSugar;
namespace Dlhis.Common.Packs
{
@@ -9,7 +10,28 @@ namespace Dlhis.Common.Packs
public override void ConfigureServices(IServiceCollection services)
{
services.AddSqlSugar();
services.AddSqlSugar(sp =>
{
var configuration = sp.GetService<IConfiguration>();
return new List<ConnectionConfig>
{
new()
{
ConfigId = "log",
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings
{
DisableNvarchar = true,
}
},
};
});
}
}
}

View File

@@ -21,7 +21,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "identity",
ConnectionString = configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
@@ -35,7 +35,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "log",
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,

View File

@@ -21,7 +21,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "identity",
ConnectionString = configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
@@ -35,7 +35,7 @@ public class SqlSugarPack : BaseAppPack
ConfigId = "default",
ConnectionString = configuration.GetSection("SqlSugarOptions:DefaultConnectionString").Value,
DbType = DbType.MySql,
DbType = DbType.MySqlConnector,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,