IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
bpipe
Posts: 19
Joined: Mon 08 Oct 2012 12:14

IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset

Post by bpipe » 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.

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

Re: IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset

Post by Shalex » Mon 01 Apr 2013 16:54

bpipe wrote:IDataReader.GetValue(int) for TimeStampTZ column returns DateTime instead of DateTimeOffset.
Thank you for the suggestion. We will post here when the TimeStampTZ -> DateTimeOffset mapping is implemented.

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

Re: IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset

Post by Shalex » Wed 03 Apr 2013 07:24

The 'AllowDateTimeOffset' connection string parameter for returning the TimeStampTZ database value like System.DateTimeOffset by PgSqlDataReader is implemented. We will post here when the corresponding build of dotConnect for PostgreSQL is available for download.

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

Re: IDataReader.GetValue() for TimeStampTZ returns DateTime instead of DateTimeOffset

Post by Shalex » Fri 05 Apr 2013 13:04

New version of dotConnect for PostgreSQL 6.6 is released!
It can be downloaded from http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=3&t=26317.

Post Reply