You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
varconnection=db.Database.GetDbConnection();connection.Open();usingvarparam=newOracleParameter();param.OracleDbType=OracleDbType.TimeStampTZ;param.Value=newOracleTimeStampTZ(DateTime.Parse("1999-10-29 01:30:00"),"America/Los_Angeles");usingvarcmd=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?
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: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 specifyingDateTime
+ timezone, for example: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:Could you please add support to Oracle EF Core Provider for
OracleTimestampWithTimezone
? My goal is to store a value inTIMESTAMP 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.
The text was updated successfully, but these errors were encountered: