diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index 66078ea6e..b66c17f8c 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs @@ -457,7 +457,7 @@ namespace SqlSugar private bool IsSubMethod(MethodCallExpression express, string methodName) { - return SubTools.SubItems(this.Context).Any(it => it.Name == methodName) && express.Object != null && express.Object.Type.Name == "Subqueryable`1"; + return SubTools.SubItemsConst.Any(it => it.Name == methodName) && express.Object != null && express.Object.Type.Name == "Subqueryable`1"; } private void CheckMethod(MethodCallExpression expression) { diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/SubTools.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/SubTools.cs index 41e55a287..9dac17bae 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/SubTools.cs +++ b/Src/Asp.Net/SqlSugar/ExpressionsToSql/Subquery/SubTools.cs @@ -23,6 +23,8 @@ namespace SqlSugar }; } + public static List SubItemsConst = SubItems(null); + public static string GetMethodValue(ExpressionContext context, Expression item, ResolveExpressType type) { var newContext = context.GetCopyContext();