From 2b42eb248b3027ae2bd19749e095562e6c08a1f8 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 2 Apr 2024 10:10:42 +0800 Subject: [PATCH] fix DbType --- Src/Dlhis.Basic/Packs/SqlSugarPack.cs | 4 ++-- Src/Dlhis.Common/Packs/SqlSugarPack.cs | 24 ++++++++++++++++++- Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs | 4 ++-- Src/Dlhis.Sys/SqlSugarPack.cs | 4 ++-- 4 files changed, 29 insertions(+), 7 deletions(-) diff --git a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs index 5dbaabc5..9e6d5ca3 100644 --- a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs +++ b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs @@ -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, diff --git a/Src/Dlhis.Common/Packs/SqlSugarPack.cs b/Src/Dlhis.Common/Packs/SqlSugarPack.cs index 4c984c21..fe5454cb 100644 --- a/Src/Dlhis.Common/Packs/SqlSugarPack.cs +++ b/Src/Dlhis.Common/Packs/SqlSugarPack.cs @@ -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(); + + return new List + { + new() + { + ConfigId = "log", + + ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value, + DbType = DbType.MySqlConnector, + InitKeyType = InitKeyType.Attribute, + IsAutoCloseConnection = true, + + MoreSettings = new ConnMoreSettings + { + DisableNvarchar = true, + } + }, + }; + }); } } } diff --git a/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs b/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs index 116c1c6b..9953056c 100644 --- a/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs +++ b/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs @@ -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, diff --git a/Src/Dlhis.Sys/SqlSugarPack.cs b/Src/Dlhis.Sys/SqlSugarPack.cs index b71cf8f5..bcdb702f 100644 --- a/Src/Dlhis.Sys/SqlSugarPack.cs +++ b/Src/Dlhis.Sys/SqlSugarPack.cs @@ -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,