diff --git a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs index f17ea13f4..aa90085ef 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs @@ -750,7 +750,7 @@ namespace SqlSugar UtilMethods.StartCustomSplitTable(this.Context, typeof(T)); var splitTableAttribute = typeof(T).GetCustomAttribute(); if (splitTableAttribute != null) - { + { return SplitTable((splitTableAttribute as SplitTableAttribute).SplitType); } else diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs index 7f3835e01..68b35e1e3 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs @@ -335,6 +335,15 @@ namespace SqlSugar context.CurrentConnectionConfig.ConfigureExternalServices.SplitTableService = (ISplitTableService)Activator.CreateInstance(splitTableAttribute.CustomSplitTableService); } + if ( + context?.CurrentConnectionConfig?.ConfigureExternalServices?.SplitTableService !=null + && splitTableAttribute.CustomSplitTableService == null + && context.EntityMaintenance.GetEntityInfo(entityType).DbTableName?.EndsWith("_{year}{month}{day}") ==true + ) + { + context.CurrentConnectionConfig.ConfigureExternalServices.SplitTableService + = null; + } } public static void ConvertParameter(SugarParameter p, ISqlBuilder builder) {