diff --git a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs index f36fa9526..aaf48c68f 100644 --- a/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs +++ b/Src/Asp.Net/SqlSugar/Utilities/UtilMethods.cs @@ -19,7 +19,15 @@ namespace SqlSugar { internal static void EndCustomSplitTable(ISqlSugarClient context,Type entityType) { + if (context == null || entityType == null) + { + return; + } var splitTableAttribute = entityType.GetCustomAttribute(); + if (splitTableAttribute == null) + { + return; + } if (splitTableAttribute.CustomSplitTableService != null) { context.CurrentConnectionConfig.ConfigureExternalServices.SplitTableService = null; @@ -28,6 +36,15 @@ namespace SqlSugar internal static void StartCustomSplitTable(ISqlSugarClient context, Type entityType) { + if (context == null || entityType == null) + { + return; + } + var splitTableAttribute = entityType.GetCustomAttribute(); + if (splitTableAttribute == null) + { + return; + } var splitTableAttribute = entityType.GetCustomAttribute(); if (splitTableAttribute.CustomSplitTableService != null) {