From 49a1eecb45bf28b9c487539bacbd3d00395a4b10 Mon Sep 17 00:00:00 2001 From: 28810 <28810@YEXIANGQIN> Date: Thu, 1 Aug 2019 10:05:08 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BC=98=E5=8C=96=20=E5=86=85=E9=83=A8?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=AE=A1=E7=90=86=E7=9A=84=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=AF=BC=E8=88=AA=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E4=BD=BF=E7=94=A8=E6=8A=BD=E8=B1=A1=E7=B1=BB/?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=97=B6=E5=87=BA=E7=8E=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/Internal/UtilsExpressionTree.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs index a9d8715f..5a74b980 100644 --- a/FreeSql/Internal/UtilsExpressionTree.cs +++ b/FreeSql/Internal/UtilsExpressionTree.cs @@ -155,8 +155,7 @@ namespace FreeSql.Internal trytb.ColumnsByCsIgnore.Add(p.Name, col); continue; } - if (entityDefault == null) entityDefault = Activator.CreateInstance(entity); - colattr.DbDefautValue = trytb.Properties[p.Name].GetValue(entityDefault); + if (entityDefault != null) colattr.DbDefautValue = trytb.Properties[p.Name].GetValue(entityDefault); if (colattr.DbDefautValue != null && p.PropertyType != colattr.MapType) colattr.DbDefautValue = Utils.GetDataReaderValue(colattr.MapType, colattr.DbDefautValue); if (colattr.DbDefautValue == null) colattr.DbDefautValue = tp?.defaultValue; if (colattr.IsNullable == false && colattr.DbDefautValue == null)