Skip to content

Commit

Permalink
- 修复 DateOnly/TimeOnly AOT 裁剪默认报错的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Jan 9, 2025
1 parent 998027a commit ca111cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FreeSql/Internal/UtilsExpressionTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ca111cd

Please sign in to comment.