mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	- 调整 ExpressionTree 从 DateTime 转化 DateTimeOffset 使用 ticks;#87
This commit is contained in:
		@@ -1463,7 +1463,8 @@ namespace FreeSql.Internal
 | 
			
		||||
        static MethodInfo MethodToString = typeof(Utils).GetMethod("ToStringConcat", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(object) }, null);
 | 
			
		||||
        static MethodInfo MethodBigIntegerParse = typeof(Utils).GetMethod("ToBigInteger", BindingFlags.NonPublic | BindingFlags.Static, null, new[] { typeof(string) }, null);
 | 
			
		||||
        static PropertyInfo PropertyDateTimeOffsetDateTime = typeof(DateTimeOffset).GetProperty("DateTime", BindingFlags.Instance | BindingFlags.Public);
 | 
			
		||||
        static ConstructorInfo CtorDateTimeOffsetArgsDateTime = typeof(DateTimeOffset).GetConstructor(new[] { typeof(DateTime), typeof(TimeSpan) });
 | 
			
		||||
        static PropertyInfo PropertyDateTimeTicks = typeof(DateTime).GetProperty("Ticks", BindingFlags.Instance | BindingFlags.Public);
 | 
			
		||||
        static ConstructorInfo CtorDateTimeOffsetArgsTicks = typeof(DateTimeOffset).GetConstructor(new[] { typeof(long), typeof(TimeSpan) });
 | 
			
		||||
 | 
			
		||||
        public static ConcurrentBag<Func<LabelTarget, Expression, string, Expression>> GetDataReaderValueBlockExpressionSwitchTypeFullName = new ConcurrentBag<Func<LabelTarget, Expression, string, Expression>>();
 | 
			
		||||
        public static Expression GetDataReaderValueBlockExpression(Type type, Expression value)
 | 
			
		||||
@@ -1772,7 +1773,7 @@ namespace FreeSql.Internal
 | 
			
		||||
                            Expression.IfThenElse(
 | 
			
		||||
                                Expression.AndAlso(Expression.Equal(Expression.Constant(type), Expression.Constant(typeof(DateTimeOffset))), Expression.TypeEqual(valueExp, typeof(DateTime))),
 | 
			
		||||
                                Expression.Return(returnTarget, Expression.Convert(
 | 
			
		||||
                                    Expression.New(CtorDateTimeOffsetArgsDateTime, Expression.Convert(valueExp, typeof(DateTime)), Expression.Constant(TimeSpan.Zero)), typeof(object))),
 | 
			
		||||
                                    Expression.New(CtorDateTimeOffsetArgsTicks, Expression.MakeMemberAccess(Expression.Convert(valueExp, typeof(DateTime)), PropertyDateTimeTicks), Expression.Constant(TimeSpan.Zero)), typeof(object))),
 | 
			
		||||
                                defaultRetExp
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user