1- // Copyright (C) 2003-2010 Xtensive LLC.
2- // All rights reserved .
3- // For conditions of distribution and use, see license .
1+ // Copyright (C) 2009-2021 Xtensive LLC.
2+ // This code is distributed under MIT license terms .
3+ // See the License.txt file in the project root for more information .
44// Created by: Denis Krjuchkov
55// Created: 2009.02.24
66
@@ -15,13 +15,10 @@ namespace Xtensive.Orm.Providers
1515 [ CompilerContainer ( typeof ( SqlExpression ) ) ]
1616 internal static class TimeSpanCompilers
1717 {
18- private static readonly long TicksPerMillisecond = TimeSpan . FromMilliseconds ( 1 ) . Ticks ;
19-
2018 private static readonly double MillisecondsPerDay = TimeSpan . FromDays ( 1 ) . TotalMilliseconds ;
2119 private static readonly double MillisecondsPerHour = TimeSpan . FromHours ( 1 ) . TotalMilliseconds ;
2220 private static readonly double MillisecondsPerMinute = TimeSpan . FromMinutes ( 1 ) . TotalMilliseconds ;
2321 private static readonly double MillisecondsPerSecond = TimeSpan . FromSeconds ( 1 ) . TotalMilliseconds ;
24- private static readonly double MillisecondsPerTick = TimeSpan . FromTicks ( 1 ) . TotalMilliseconds ;
2522
2623 private const int NanosecondsPerTick = 100 ;
2724 private const int NanosecondsPerMillisecond = 1000000 ;
@@ -272,6 +269,11 @@ public static SqlExpression TimeSpanOperatorUnaryPlus(
272269 public static SqlExpression TimeSpanOperatorUnaryNegation (
273270 [ Type ( typeof ( TimeSpan ) ) ] SqlExpression t )
274271 {
272+ var context = ExpressionTranslationContext . Current ;
273+ var isOracle = context . ProviderInfo . ProviderName . Equals ( WellKnown . Provider . Oracle , StringComparison . Ordinal ) ;
274+ if ( isOracle ) {
275+ return ( - 1 * t ) ;
276+ }
275277 return - t ;
276278 }
277279
0 commit comments