From b7a6e5e8db76c82800dacb193816d521a3c2a8a3 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 26 Feb 2024 16:48:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=8D=87=E7=BA=A7changedb;=20=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=BA=BA=E8=84=B8token=E8=A7=A3=E6=9E=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/GainfoService.cs | 8 +++---- Src/Dlhis.Basic/Packs/DataProtectionJob.cs | 2 +- Src/Dlhis.Basic/Packs/SqlSugarPack.cs | 4 ++-- Src/Dlhis.Entity/Dlhis.Entity.csproj | 2 +- Src/Dlhis.ScheduledTask/Program.cs | 2 +- Src/Dlhis.Sys/SqlSugarPack.cs | 23 ++++++++++++++++++- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index a0341149..85656105 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -229,7 +229,7 @@ public class GainfoService : IGainfoService Face = request.Face }; - await dbContext.Insertable(face).ExecuteCommandAsync(); + await dbContext.InsertAsync(face); } else { @@ -240,7 +240,7 @@ public class GainfoService : IGainfoService } face.Face = request.Face; - await dbContext.Updateable(face).ExecuteCommandAsync(); + await dbContext.UpdateAsync(face); } //生成任务 @@ -270,7 +270,7 @@ public class GainfoService : IGainfoService Face = request.Face }; - await dbContext.Insertable(face).ExecuteCommandAsync(); + await dbContext.InsertAsync(face); } else { @@ -281,7 +281,7 @@ public class GainfoService : IGainfoService } face.Face = request.Face; - await dbContext.Updateable(face).ExecuteCommandAsync(); + await dbContext.UpdateAsync(face); } //生成任务 diff --git a/Src/Dlhis.Basic/Packs/DataProtectionJob.cs b/Src/Dlhis.Basic/Packs/DataProtectionJob.cs index 0e78ff97..9bb6e44b 100644 --- a/Src/Dlhis.Basic/Packs/DataProtectionJob.cs +++ b/Src/Dlhis.Basic/Packs/DataProtectionJob.cs @@ -13,7 +13,7 @@ public class DataProtectionJobPack : BaseAppPack { var redisConnection = ConnectionMultiplexer.Connect(Configuration.GetSection($"{nameof(RedisOptions)}:{nameof(RedisOptions.ConnectionString)}").Value); services.AddDataProtection() - .SetApplicationName("basic") + .SetApplicationName("yiliantong") .PersistKeysToStackExchangeRedis(redisConnection, "DataProtection-Keys"); } } diff --git a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs index b46e77d5..6979080e 100644 --- a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs +++ b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs @@ -65,8 +65,8 @@ public class SqlSugarPack : BaseAppPack db.Client.CodeFirst.InitTables(tables); var faceDb = db.ChangeDb("face"); - faceDb.DbMaintenance.CreateDatabase(); - faceDb.CodeFirst.InitTables(); + faceDb.Client.DbMaintenance.CreateDatabase(); + faceDb.Client.CodeFirst.InitTables(); } } diff --git a/Src/Dlhis.Entity/Dlhis.Entity.csproj b/Src/Dlhis.Entity/Dlhis.Entity.csproj index 7a8afcc3..09f988da 100644 --- a/Src/Dlhis.Entity/Dlhis.Entity.csproj +++ b/Src/Dlhis.Entity/Dlhis.Entity.csproj @@ -11,7 +11,7 @@ - + diff --git a/Src/Dlhis.ScheduledTask/Program.cs b/Src/Dlhis.ScheduledTask/Program.cs index dd22aac6..64b4094a 100644 --- a/Src/Dlhis.ScheduledTask/Program.cs +++ b/Src/Dlhis.ScheduledTask/Program.cs @@ -27,7 +27,7 @@ public class Startup : DefaultStartup var reidConnection = Configuration.GetSection($"{nameof(RedisOptions)}:{nameof(RedisOptions.ConnectionString)}").Value; var redis = ConnectionMultiplexer.Connect(reidConnection); services.AddDataProtection() - .SetApplicationName("scheduled") + .SetApplicationName("yiliantong") .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); } diff --git a/Src/Dlhis.Sys/SqlSugarPack.cs b/Src/Dlhis.Sys/SqlSugarPack.cs index 59e2db32..3c58cc41 100644 --- a/Src/Dlhis.Sys/SqlSugarPack.cs +++ b/Src/Dlhis.Sys/SqlSugarPack.cs @@ -13,7 +13,28 @@ public class SqlSugarPack : BaseAppPack public override void ConfigureServices(IServiceCollection services) { - services.AddSqlSugar(); + services.AddSqlSugar(sp => + { + var configuration = sp.GetService(); + + return new List + { + new ConnectionConfig + { + ConfigId = "identity", + + ConnectionString = configuration.GetSection("SqlSugarOptions:IdentityConnectionString").Value, + DbType = DbType.MySql, + InitKeyType = InitKeyType.Attribute, + IsAutoCloseConnection = true, + + MoreSettings = new ConnMoreSettings + { + DisableNvarchar = true, + } + } + }; + }); } }