Reading TimeStampTZ doesn't not assign System.DateTime.Kind
I have an issue where I can assign a UTC DateTime value to a record, but ODP.Net doesn't assign the System.DateTime.Kind property as the value is read back from the database. While the tick value is accurate, the kind is marked as Unspecified whereas it should be UTC.
I believe the bug is in the following location:
Assembly: Oracle.DataAccess.dll
Class: Oracle.DataAccess.Types.DateTimeConv
Method: public static unsafe DateTime GetDateTime(OpoTSValCtx* pValCtx, OracleDbType oraType, bool bCheck)
This method contains a test that (oraType == OracleDbType.TimeStampTZ) yet it doesn't use the System.DateTime constructor to specify the kind:
The current implementation is:
DateTime time = new DateTime(pValCtx.m_year, pValCtx.m_month, pValCtx.m_day, pValCtx.m_hour, pValCtx.m_minute, pValCtx.m_second);
This line of code is from version 10.2.0.100, but I have also checked 10.2.0.2.21 which has the same problem.
This would be fixed by using the following constructor (where the type is TimeStampTZ):
DateTime time = new DateTime(pValCtx.m_year, pValCtx.m_month, pValCtx.m_day, pValCtx.m_hour, pValCtx.m_minute, pValCtx.m_second, System.DateTimeKind.Utc);