Update split table

This commit is contained in:
sunkaixuan
2024-02-02 18:46:49 +08:00
parent 08c12e36d6
commit e89b526f81
2 changed files with 12 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ namespace SqlSugar
{ {
if (StaticConfig.SplitTableGetTablesFunc != null) if (StaticConfig.SplitTableGetTablesFunc != null)
{ {
return StaticConfig.SplitTableGetTablesFunc(); return GetCustomGetTables();
} }
var oldIsEnableLogEvent = this.Context.Ado.IsEnableLogEvent; var oldIsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false; this.Context.Ado.IsEnableLogEvent = false;
@@ -74,6 +74,16 @@ namespace SqlSugar
return result; return result;
} }
private List<SplitTableInfo> GetCustomGetTables()
{
var oldIsEnableLogEvent = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false;
var tables = StaticConfig.SplitTableGetTablesFunc();
List<SplitTableInfo> result = Service.GetAllTables(this.Context, EntityInfo, tables.Select(it=>new DbTableInfo() { Name=it.TableName }).ToList());
this.Context.Ado.IsEnableLogEvent = oldIsEnableLogEvent;
return result.ToList();
}
public string GetDefaultTableName() public string GetDefaultTableName()
{ {
return Service.GetTableName(this.Context,EntityInfo); return Service.GetTableName(this.Context,EntityInfo);

View File

@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>SqlSugarCore</id> <id>SqlSugarCore</id>
<version>5.1.4.138</version> <version>5.1.4.139-preview01</version>
<authors>sunkaixuan</authors> <authors>sunkaixuan</authors>
<owners>果糖大数据科技</owners> <owners>果糖大数据科技</owners>
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl> <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0.html</licenseUrl>