Allow ZonedDateTime Comparers in queries/indexes
Closed this issue · 1 comments
mattjohnsonpint commented
Noda Time 2.0 removed comparable operator support (>
, <
, etc.) on ZonedDateTime
, forcing the developer to choose either ZonedDateTime.Comparer.Instant
or ZonedDateTime.Comparer.Local
instead.
Attempting to use these in a linq query or static index results in an InvalidOperationException
. Need to teach Raven how to interpret these.
Both of the Can_Use_NodaTime_ZonedDateTime_In_Static_Index...
tests are failing due to this.
Stack trace:
System.InvalidOperationException
Cannot understand how to translate Comparer.Instant.Compare(x.ZonedDateTime, value(Raven.Client.NodaTime.Tests.NodaZonedDateTimeTests+<>c__DisplayClass9_0).zdt)
at Raven.Client.Linq.LinqPathProvider.GetPath(Expression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.GetMemberDirect(Expression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.VisitLessThan(BinaryExpression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.VisitQueryableMethodCall(MethodCallExpression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.VisitQueryableMethodCall(MethodCallExpression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.GetDocumentQueryFor(Expression expression)
at Raven.Client.Linq.RavenQueryProviderProcessor`1.Execute(Expression expression)
at Raven.Client.Linq.RavenQueryInspector`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Raven.Client.NodaTime.Tests.NodaZonedDateTimeTests.Can_Use_NodaTime_ZonedDateTime_In_Static_Index(ZonedDateTime zdt) in D:\Dev\oss\RavenDB-NodaTime\test\Raven.Client.NodaTime.Tests\NodaZonedDateTimeTests.cs:line 175
at Raven.Client.NodaTime.Tests.NodaZonedDateTimeTests.Can_Use_NodaTime_ZonedDateTime_In_Static_Index_NearIsoMax() in D:\Dev\oss\RavenDB-NodaTime\test\Raven.Client.NodaTime.Tests\NodaZonedDateTimeTests.cs:line 147
mattjohnsonpint commented
This turned out to be too difficult. Hope it doesn't break anyone, but I'm not going to support this, unless someone out there want to figure it out.