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

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
kfultz
Posts: 3
Joined: Fri 12 Oct 2018 03:17

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

Post by kfultz » Fri 12 Oct 2018 03:54

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

kfultz
Posts: 3
Joined: Fri 12 Oct 2018 03:17

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

Post by kfultz » Fri 12 Oct 2018 22:03

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Mon 15 Oct 2018 15:21

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.

kfultz
Posts: 3
Joined: Fri 12 Oct 2018 03:17

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

Post by kfultz » Mon 15 Oct 2018 20:44

Thanks for investigating. I'll be on the lookout for the update.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Thu 25 Oct 2018 16:45

The bug with filtering by the DateTimeOffset property is fixed (Oracle): viewtopic.php?f=31&t=37914.

Post Reply