PostgreSQL time type trouble

Posts   
 
    
doktron
User
Posts: 4
Joined: 28-Nov-2018
# Posted on: 28-Nov-2018 18:13:53   

I've upgraded an old project from 2.6 (.lgp) to a 5.5 (.llblgenproj) project and have trouble with a bunch of tables that have columns of type "time without time zone". The db is PostgreSQL 9.2 In the old project these columns were mapped to System.TimeSpan but now the designer says they are mapped to System.DateTime and i get errors like this:

The mapping of sub-element '[columnnameredacted]' of entity '[tablenameredacted]' for the target database with the driver 'PostgreSql Driver (Npgsql)' has the following errors:
  • TypeConverterToUse: The .NET types of the mapped element field and the target field aren't the same/compatible and no implicit conversion is defined by the target framework for these types, so a type converter is needed.

Why does the LLBLGen designer think that these columns should be DateTime and how can I make them TimeSpan?

Walaa avatar
Walaa
Support Team
Posts: 14986
Joined: 21-Aug-2005
# Posted on: 28-Nov-2018 19:59:50   

with a bunch of tables that have columns of type "time without time zone".

Just to be sure, for the PostgreSQL type, do you mean time or timestamp?

ref: https://www.npgsql.org/doc/types/datetime.html

doktron
User
Posts: 4
Joined: 28-Nov-2018
# Posted on: 28-Nov-2018 20:15:10   

I mean time, not timestamp

Edit: To be extra clear. In INFORMATION_SCHEMA table COLUMNS column data_type the value is "time without time zone".

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Nov-2018 08:53:28   

What version of NpgSql are you usien?

David Elizondo | LLBLGen Support Team
doktron
User
Posts: 4
Joined: 28-Nov-2018
# Posted on: 29-Nov-2018 09:12:18   

4.0.3.0 is in my GAC, but can i see somewhere in the designer which version it uses?

doktron
User
Posts: 4
Joined: 28-Nov-2018
# Posted on: 29-Nov-2018 09:47:48   

Ok, figured it out. I made the wrong assumption. Double checked the old 2.6 project and this problem originated from that project. If i removed the entity in the 5.5 project and re-reversed engineered it from db it got correctly mapped to TimeSpan. Sorry to have wasted your time frowning