Update CodeFirst

This commit is contained in:
sunkaixuan 2025-07-31 14:26:47 +08:00
parent edc83cdaea
commit f3181c9e2e

View File

@ -64,6 +64,8 @@ namespace SqlSugar
} }
public virtual void InitTables(Type entityType) public virtual void InitTables(Type entityType)
{ {
var oldSlave = this.Context.CurrentConnectionConfig.SlaveConnectionConfigs;
this.Context.CurrentConnectionConfig.SlaveConnectionConfigs = null;
var splitTableAttribute = entityType.GetCustomAttribute<SplitTableAttribute>(); var splitTableAttribute = entityType.GetCustomAttribute<SplitTableAttribute>();
if (splitTableAttribute != null) if (splitTableAttribute != null)
{ {
@ -104,6 +106,7 @@ namespace SqlSugar
RestMappingTables(oldTableList); RestMappingTables(oldTableList);
} }
this.Context.CurrentConnectionConfig.SlaveConnectionConfigs = oldSlave;
} }
@ -189,7 +192,7 @@ namespace SqlSugar
foreach (var type in types) foreach (var type in types)
{ {
try try
{ {
GetDifferenceTables(result, type); GetDifferenceTables(result, type);
} }
catch (Exception ex) catch (Exception ex)