Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for OracleTimestampWithTimezone to Oracle EF Core Provider #268

Open
@rtcpw

Description

Oracle has a type TIMESTAMP WITH TIME ZONE, and it is recommended to use the TZR TZD format, which looks like this as a PL/SQL literal:

TIMESTAMP '1999年10月29日 01:30:00 America/Los_Angeles PDT'

The appropriate .NET type for timestamp supported by Oracle EF Provider is DateTimeOffset. The problem is, DateTimeOffset has no way to specify TZR (such as America/Los_Angeles) and neither TZD (such as PDT in the example above).

There exists the OracleTimestampWithTimezone in Oracle ADO.NET driver, which does support specifying DateTime + timezone, for example:

var connection = db.Database.GetDbConnection();
connection.Open();
using var param = new OracleParameter();
param.OracleDbType = OracleDbType.TimeStampTZ;
param.Value = new OracleTimeStampTZ(DateTime.Parse("1999-10-29 01:30:00"), "America/Los_Angeles");
using var cmd = connection.CreateCommand();
cmd.CommandText = "INSERT INTO tz_test (tz_value) VALUES (:1)";
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();

However, it seems impossible to replicate this functionality using Oracle EF Provider. If I create an entity and add a property of type OracleTimestampWithTimezone, I get an exception:

'The property 'TzTest.TzValue' could not be mapped because it is of type 'OracleTimeStampTZ', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.'

Could you please add support to Oracle EF Core Provider for OracleTimestampWithTimezone? My goal is to store a value in TIMESTAMP WITH TIME ZONE in TZR TZD format without data loss, is there any way to achieve this with Oracle EF Core?

Thank you.


For reference, I am already discussing this in EF Core repository, but so far it looks like this is something Oracle needs to add support for.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /