Split table rename index

This commit is contained in:
sunkaixuan
2023-12-22 15:11:18 +08:00
parent 785aa7a154
commit cb81ccc714

View File

@@ -320,7 +320,14 @@ namespace SqlSugar
{ {
if (entityInfo.Type.GetCustomAttribute<SplitTableAttribute>() != null) if (entityInfo.Type.GetCustomAttribute<SplitTableAttribute>() != null)
{ {
item.IndexName = item.IndexName + entityInfo.DbTableName; if (item.IndexName?.Contains("{split_table}") == true)
{
item.IndexName = item.IndexName.Replace("{split_table}", entityInfo.DbTableName);
}
else
{
item.IndexName = item.IndexName + entityInfo.DbTableName;
}
} }
if (this.Context.CurrentConnectionConfig.IndexSuffix.HasValue()) if (this.Context.CurrentConnectionConfig.IndexSuffix.HasValue())
{ {