IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset
Posted: Mon 01 Apr 2013 12:41
IDataReader.GetValue(int) for TimeStampTZ column returns DateTime instead of DateTimeOffset.
Though you can get the desired result with some "magic" hand written code, it is not possible to use your driver with NHibernate, which expects DateTimeOffset typed obj.
In any case, I think TimeStampTZ columns should return DateTimeOffset.
I guess this was done for backward compatibility, because when IDataReader was designed there were no DateTimeOffset, and that's why it doesn't provide GetDateTimeOffset(int) method, and old programs expect DateTime, but you could provide ConnectionString configuration parameter to tell driver to return DateTimeOffset for TimeStampTZ in worst case.
Though you can get the desired result with some "magic" hand written code, it is not possible to use your driver with NHibernate, which expects DateTimeOffset typed obj.
In any case, I think TimeStampTZ columns should return DateTimeOffset.
I guess this was done for backward compatibility, because when IDataReader was designed there were no DateTimeOffset, and that's why it doesn't provide GetDateTimeOffset(int) method, and old programs expect DateTime, but you could provide ConnectionString configuration parameter to tell driver to return DateTimeOffset for TimeStampTZ in worst case.