Page 1 of 1

Support for filtering with DateTimeOffset and Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE"

Posted: Fri 12 Oct 2018 03:54
by kfultz
I have an aspnetcore API with an entity that maps Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE" columns to DateTimeOffset. Storage and retrieval seem to work fine. But when I try to build a linq expression to filter on those columns, I get the following error.

Code: Select all

[Table(Name = "ORDER")]
public class OrderEntity
{
    [Column(Name = "CREATED", DbType = "TIMESTAMP(6) WITH LOCAL TIME ZONE NOT NULL")]
    public DateTimeOffset Created { get; set; }
}

Code: Select all

var result = _dataContext.Orders.Where(r => r.Created >= DateTimeOffset.Now.AddDays(-1)).ToList();

Code: Select all

System.NotSupportedException: 'Cannot use "TIMESTAMP(6) WITH LOCAL TIME ZONE" type value in "DateTimeOffset" type argument'
at Devart.Data.Linq.Engine.DbMethodCallConverter.CheckConversionToParameterType(SqlExpression argumentValue, Type parameterType)
Any ideas? This is using Devart.Data.Oracle.Linq v4.8.1566

Re: Support for filtering with DateTimeOffset and Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE"

Posted: Fri 12 Oct 2018 22:03
by kfultz
It looks like this may be unnecessary. In further experimenting, I see the Oracle session time zone is automatically following the API's local time zone, which means the entities can use plain old DateTime and speak in terms of local time, regardless of whether the API server and Database are running on different time zones.

Re: Support for filtering with DateTimeOffset and Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE"

Posted: Mon 15 Oct 2018 15:21
by Shalex
kfultz wrote: System.NotSupportedException: 'Cannot use "TIMESTAMP(6) WITH LOCAL TIME ZONE" type value in "DateTimeOffset" type argument'
at Devart.Data.Linq.Engine.DbMethodCallConverter.CheckConversionToParameterType(SqlExpression argumentValue, Type parameterType)
Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

Re: Support for filtering with DateTimeOffset and Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE"

Posted: Mon 15 Oct 2018 20:44
by kfultz
Thanks for investigating. I'll be on the lookout for the update.

Re: Support for filtering with DateTimeOffset and Oracle "TIMESTAMP(6) WITH LOCAL TIME ZONE"

Posted: Thu 25 Oct 2018 16:45
by Shalex
The bug with filtering by the DateTimeOffset property is fixed (Oracle): viewtopic.php?f=31&t=37914.