From 321dd3afc80a25fa1c4a9e2d3ace128e16d57a40 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 29 Sep 2024 11:36:59 +0800 Subject: [PATCH] Update MySqlBackUp --- .../SqlSugar/Infrastructure/StaticConfig.cs | 1 + .../MySql/DbMaintenance/MySqlDbMaintenance.cs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs b/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs index c57078958..5cb438a76 100644 --- a/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs +++ b/Src/Asp.NetCore2/SqlSugar/Infrastructure/StaticConfig.cs @@ -16,6 +16,7 @@ namespace SqlSugar public const string CodeFirst_BigString = "varcharmax,longtext,text,clob"; public static string CodeFirst_MySqlCollate{get;set;} public static string CodeFirst_MySqlTableEngine { get; set; } + public static Type Backup_MySqlBackupType { get; set; } public static Func CustomSnowFlakeFunc; public static Func CustomSnowFlakeTimeErrorFunc; diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs index 1343aab64..ff9e07ffe 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs @@ -713,9 +713,16 @@ WHERE EVENT_OBJECT_TABLE = '" + tableName + "'"); try { - Assembly currentAssembly = Assembly.GetExecutingAssembly(); - string exePath = currentAssembly.Location.Replace("SqlSugar.dll", "MySqlBackupNet.MySqlConnector.dll"); - assembly = Assembly.LoadFrom(exePath); + if (StaticConfig.Backup_MySqlBackupType != null) + { + assembly = StaticConfig.Backup_MySqlBackupType.Assembly; + } + else + { + Assembly currentAssembly = Assembly.GetExecutingAssembly(); + string exePath = currentAssembly.Location.Replace("SqlSugar.dll", "MySqlBackupNet.MySqlConnector.dll"); + assembly = Assembly.LoadFrom(exePath); + } } catch (Exception) {