From ca111cd52f0bdfa1655d35c7af9c106c053f7031 Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Thu, 9 Jan 2025 08:40:58 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20DateOnly/TimeOnly=20AO?= =?UTF-8?q?T=20=E8=A3=81=E5=89=AA=E9=BB=98=E8=AE=A4=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FreeSql/Internal/UtilsExpressionTree.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FreeSql/Internal/UtilsExpressionTree.cs b/FreeSql/Internal/UtilsExpressionTree.cs index ef2d9b667..72ceec558 100644 --- a/FreeSql/Internal/UtilsExpressionTree.cs +++ b/FreeSql/Internal/UtilsExpressionTree.cs @@ -2430,7 +2430,7 @@ Expression LocalFuncGetExpression(bool ignoreArray = false) Expression.Return(returnTarget, Expression.Convert(Expression.Call(MethodTimeSpanFromSeconds, tryparseVarDblExp), typeof(object))), Expression.Return(returnTarget, Expression.Convert(Expression.Default(typeOrg), typeof(object))) ); - if (TypeTimeOnly != null) timeSpanExp = Expression.IfThenElse( + if (TypeTimeOnly != null && MethodTimeOnlyToTimeSpan != null) timeSpanExp = Expression.IfThenElse( Expression.TypeIs(valueExp, TypeTimeOnly), Expression.Return(returnTarget, Expression.Convert(Expression.Call(Expression.Convert(valueExp, TypeTimeOnly), MethodTimeOnlyToTimeSpan), typeof(object))), timeSpanExp @@ -2472,7 +2472,7 @@ Expression LocalFuncGetExpression(bool ignoreArray = false) Expression.Return(returnTarget, Expression.Convert(Expression.MakeMemberAccess(Expression.Convert(valueExp, typeof(DateTimeOffset)), PropertyDateTimeOffsetDateTime), typeof(object))), Expression.Return(returnTarget, Expression.Convert(Expression.Default(typeOrg), typeof(object))) ); - if (TypeDateOnly != null) dateTimeExp = Expression.IfThenElse( + if (TypeDateOnly != null && MethodDateOnlyToDateTime != null) dateTimeExp = Expression.IfThenElse( Expression.TypeIs(valueExp, TypeDateOnly), Expression.Return(returnTarget, Expression.Convert(Expression.Call(Expression.Convert(valueExp, TypeDateOnly), MethodDateOnlyToDateTime, Expression.Constant(TypeTimeOnly.CreateInstanceGetDefaultValue(), TypeTimeOnly)), typeof(object))), dateTimeExp