From 5acb02fa190e0b13035248fa327e7a01531b78a0 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 3 Jun 2023 12:22:00 +0800 Subject: [PATCH] Synchronization code --- .../SqlSugar/ExpressionsToSql/Subquery/Items/SubFirst.cs | 5 +---- .../SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubFirst.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubFirst.cs index a41ce1718..af3cd4c45 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubFirst.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubFirst.cs @@ -141,10 +141,7 @@ namespace SqlSugar var newMemExp = (bodyExp as MemberInitExpression); var parameters = ExpressionTool.GetParameters(exp); InitType(exp); - if (parameters.Any()) - { - this.Context.CurrentShortName = this.Context.GetTranslationColumnName(parameters.FirstOrDefault().Name); - } + SetShortName(exp, null); Check.ExceptionEasy(newMemExp == null, $"Subquery ToList(exp,true) expression {exp.ToString()} can only be it=>new class(){{Id = it.id}}", $"子查询ToList(exp,true)表达式{exp.ToString()}只能是it=>new class(){{ id=it.Id}}"); var dic = ExpressionTool.GetMemberBindingItemList(newMemExp.Bindings); var db = this.Context.SugarContext.Context; diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs index 875708c76..df67e136b 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Subquery/Items/SubToList.cs @@ -141,10 +141,7 @@ namespace SqlSugar var newMemExp = (bodyExp as MemberInitExpression); var parameters = ExpressionTool.GetParameters(exp); InitType(exp); - if (parameters.Any()) - { - this.Context.CurrentShortName = this.Context.GetTranslationColumnName(parameters.FirstOrDefault().Name); - } + SetShortName(exp, null); Check.ExceptionEasy(newMemExp == null, $"Subquery ToList(exp,true) expression {exp.ToString()} can only be it=>new class(){{Id = it.id}}", $"子查询ToList(exp,true)表达式{exp.ToString()}只能是it=>new class(){{ id=it.Id}}"); var dic=ExpressionTool.GetMemberBindingItemList(newMemExp.Bindings); var db = this.Context.SugarContext.Context;