Update codefirst

This commit is contained in:
sunkaixuan
2025-07-31 13:32:01 +08:00
parent ed4fe4e797
commit e8322d9b46
2 changed files with 4 additions and 0 deletions

View File

@@ -346,9 +346,12 @@ namespace SqlSugar
try try
{ {
this.BeginTran(); this.BeginTran();
var oldSave = this.Context.CurrentConnectionConfig.SlaveConnectionConfigs;
this.Context.CurrentConnectionConfig.SlaveConnectionConfigs = null;
if (action != null) if (action != null)
action(); action();
this.CommitTran(); this.CommitTran();
this.Context.CurrentConnectionConfig.SlaveConnectionConfigs = oldSave;
result.Data = result.IsSuccess = true; result.Data = result.IsSuccess = true;
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -207,6 +207,7 @@ namespace SqlSugar
var tempTableName = "TempDiff" + DateTime.Now.ToString("yyMMssHHmmssfff"); var tempTableName = "TempDiff" + DateTime.Now.ToString("yyMMssHHmmssfff");
var oldTableName = this.Context.EntityMaintenance.GetEntityInfo(type).DbTableName; var oldTableName = this.Context.EntityMaintenance.GetEntityInfo(type).DbTableName;
var db = new SqlSugarProvider(UtilMethods.CopyConfig(this.Context.CurrentConnectionConfig)); var db = new SqlSugarProvider(UtilMethods.CopyConfig(this.Context.CurrentConnectionConfig));
db.CurrentConnectionConfig.SlaveConnectionConfigs = null;
db.CurrentConnectionConfig.ConfigureExternalServices=UtilMethods.IsNullReturnNew(db.CurrentConnectionConfig.ConfigureExternalServices); db.CurrentConnectionConfig.ConfigureExternalServices=UtilMethods.IsNullReturnNew(db.CurrentConnectionConfig.ConfigureExternalServices);
db.CurrentConnectionConfig.ConfigureExternalServices.EntityNameService += (x, p) => db.CurrentConnectionConfig.ConfigureExternalServices.EntityNameService += (x, p) =>
{ {