From 94c7e534169368f94eaaa04b1e24757684a22516 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Mon, 17 Jul 2023 15:23:19 +0800 Subject: [PATCH] Synchronization code --- .../ExpressionsToSql/Common/ExpressionTool.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs index 7d7f325db..da6212ddd 100644 --- a/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs +++ b/Src/Asp.NetCore2/SqlSugar/ExpressionsToSql/Common/ExpressionTool.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -635,6 +636,24 @@ namespace SqlSugar //additem.Value = ""; result.Add(additem); } + else if (binding is MemberInitExpression || binding is NewExpression) + { + + var dic = ExpressionTool.GetNewExpressionItemList(binding); + foreach (var kv in dic) + { + additem = new NewExpressionInfo(); + //var leftInfo = keys[i]; + additem.Type = nameof(NewExpression); + additem.RightName = kv.Key; + additem.ShortName = ExpressionTool.GetParameters(kv.Value).First().Name; + additem.RightName = kv.Key; + additem.LeftNameName = keys[i].Name+ "." + kv.Key; + additem.RightDbName = kv.Key; + //additem.Value = ""; + result.Add(additem); + } + } else { var value = baseResolve.GetNewExpressionValue(binding);