From 935cd5ba8c47b7386a1217e7f23965c851706efd Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Fri, 16 Oct 2020 13:32:34 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20dto=20=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E6=9F=A5=E8=AF=A2=E6=97=B6=E5=BF=BD=E7=95=A5=E5=B7=B2?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E7=9A=84=E6=98=A0=E5=B0=84=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E9=87=8D=E5=A4=8D=E6=9F=A5=E8=AF=A2=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=9B#494?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/Internal/CommonExpression.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FreeSql/Internal/CommonExpression.cs b/FreeSql/Internal/CommonExpression.cs index 94ee782b..da329ba1 100644 --- a/FreeSql/Internal/CommonExpression.cs +++ b/FreeSql/Internal/CommonExpression.cs @@ -204,6 +204,7 @@ namespace FreeSql.Internal } else if (isAllDtoMap && _tables != null && _tables.Any() && initExp.NewExpression.Type != _tables.FirstOrDefault().Table.Type) { + var dicBindings = initExp.Bindings?.Select(a => a.Member.Name).Distinct().ToDictionary(a => a, a => false); //dto 映射 var dtoProps = initExp.NewExpression.Type.GetPropertiesDictIgnoreCase().Values; foreach (var dtoProp in dtoProps) @@ -212,6 +213,7 @@ namespace FreeSql.Internal { if (dtTb.Table.ColumnsByCs.TryGetValue(dtoProp.Name, out var trydtocol) == false) continue; if (trydtocol.Attribute.IsIgnore == true) continue; + if (dicBindings?.ContainsKey(dtoProp.Name) == true) continue; var child = new ReadAnonymousTypeInfo {