From 3eeeea52d8cce9dfc7003bdb218984c77b9634bb Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 19 Jul 2022 16:56:36 +0800 Subject: [PATCH] Synchronization code --- .../SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs index 373b643fe..ea8f0679b 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs @@ -557,6 +557,14 @@ namespace SqlSugar var asValue = packIfElse(GetNewExpressionValue(item)).ObjToString(); parameter.Context.Result.Append(this.Context.GetAsString(asName, asValue)); } + else if (item is MethodCallExpression && (item as MethodCallExpression).Method.Name.IsIn("Count", "Any")) + { + if (this.Context.IsSingle && this.Context.SingleTableNameSubqueryShortName == null) + { + this.Context.SingleTableNameSubqueryShortName = item.ToString().Split('.').First(); + } + parameter.Context.Result.Append(this.Context.GetAsString(asName, GetNewExpressionValue(item))); + } else if (item is MethodCallExpression || item is UnaryExpression || item is ConditionalExpression || item.NodeType == ExpressionType.Coalesce) { this.Expression = item;