LLBLGEN Pro v4.2 and NPGSQL v3.0.1

Posts   
 
    
Posts: 34
Joined: 22-Oct-2014
# Posted on: 26-Aug-2015 16:20:53   

Hi, recently .Net data provider for PostgreSQL - Npgsql was updated to 3.0.1 And there is some connection string parameters was dropped, 'encoding' for example. So now when i trying to refresh relational model i get this:

Exception message:
-------------------------------
Exception type: ArgumentException
Keyword not supported: encoding
Parameter name: keyword

So my question is: Would you support new version on Npgsql in LLBLGEN Pro v4.2?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 16:36:06   

Oh! that's indeed pretty bad. I'll try to have a fix for you tomorrow (thursday). The thing is that the encoding element has to be there for v2.x provider users so it has to be an optional setting in the UI now.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 16:50:12   

I read in the release notes that "encoding was never used anyway" frowning . So that's an easy fix. Will remove the encoding setting. Just a sec.

(edit) I saw this:

The savepoint manipulation methods on NpgsqlTransaction have been renamed from Save, and Rollback to CreateSavepoint and RollbackToSavepoint.

Not sure if you use the save point feature in our framework (creating save points inside transactions to rollback to savepoints later), but these break now (as we reflect to Save/Rollback, not these new method names). I've filed an issue at npgsql, as it's ridiculous they renamed these method names, all other ADO.NET providers which support transaction savepoint saving use Save(name)/Rollback(name) (which they had!)

Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 26-Aug-2015 16:53:49   

Hi, Otis!

And what about other changes in Npgsql? New Type Handling for example, like in this guide Migrating from 2.2 to 3.0: http://www.npgsql.org/doc/migration-3.0.html

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 17:07:29   

TheMIdgardWatcher wrote:

Hi, Otis!

And what about other changes in Npgsql? New Type Handling for example, like in this guide Migrating from 2.2 to 3.0: http://www.npgsql.org/doc/migration-3.0.html

I'll check the null issue (but I'm fairly sure we write DBNull.Value), the rest we already do or isn't used (e.g. their native types)

(edit) the null issue isn't at play, we already convert all null values to DBNull.Value. So it's the save points in transactions (which is likely something not a lot of people use anyway) which they have to fix (IMHO, but we'll see) and the driver issue, which I'll fix now.

Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 26-Aug-2015 17:09:47   

Otis wrote:

I'll check the null issue (but I'm fairly sure we write DBNull.Value), the rest we already do or isn't used (e.g. their native types)

This is great news! So i'll wait for 'encoding' fix. Thanks!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 17:22:00   

Save point methods are being renamed simple_smile https://github.com/npgsql/npgsql/issues/738.

I see 'SSL' is an issue too. Will look into how we can keep v2 and v3 supporting with the same code.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 17:39:25   

Could you try the attached dll (copy as _administrator to <llblgen pro installation folder>\Drivers\PostgreSql ) ?

(it might be windows blocked the dll, in that case rightclick the dll in windows explorer -> properties -> unblock)

Attachments
Filename File size Added on Approval
HOTFIX_PostgreSqlDBDriver_42_08262015.zip 21,369 26-Aug-2015 17:39.30 Approved
Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 26-Aug-2015 17:43:54   

Otis wrote:

Could you try the attached dll (copy as _administrator to <llblgen pro installation folder>\Drivers\PostgreSql ) ?

(it might be windows blocked the dll, in that case rightclick the dll in windows explorer -> properties -> unblock)

Yes, i'll try, just a sec

UPD: Nope, there is new error message:

Keyword not supported: protocol
Parameter name: keyword
LLBLGen Pro version 4.2. Build October 3rd, 2014
-----[Core exception]--------------------
   at Npgsql.NpgsqlConnectionStringBuilder.GetProperty(String keyword)
   at Npgsql.NpgsqlConnectionStringBuilder.set_Item(String keyword, Object value)
   at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
   at Npgsql.NpgsqlConnection.set_ConnectionString(String value)
   at SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.CreateConnection()
   at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData(Boolean showSuccess)
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 17:51:54   

Hmm, they don't mention that in their doc. I'll mention that. I have to wait for an answer from the npgsql team on this. (Issue is debated in the link mentioned above).

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 18:03:23   

Protocol seems obsolete in v2 already so I'll remove that one too. Just a sec.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 18:05:27   

Attempt 2. Please try the attached dll simple_smile

(I can't test it at the moment, as I want to test for v2 as well. If v3 seems to work, I know v2 works, so I can install v3 and test with that, as there's just 1 factory definable in the machine.config rage )

Attachments
Filename File size Added on Approval
HOTFIX_PostgreSqlDBDriver_42_08262015_2.zip 21,168 26-Aug-2015 18:05.31 Approved
Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 26-Aug-2015 18:24:37   

Yes, it's working! I was able to refresh relational model now! Thank You very much for support!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 26-Aug-2015 19:17:31   

Awesome simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 27-Aug-2015 10:14:47   

Hi! It's me again. I'm suffering with error of incompatible type casts of time without timezone with new version of npgsql and yours PostgreSQL DB driver. We have a two field TimeFrom and TimeTo, wich have time without timezone PostgreSQL type. CREATE TABLE script contains this fields definition like:


...
timefrom time without time zone,
timeto time without time zone,
...

So with new version, npgsql now casts this type to timespan: http://www.npgsql.org/doc/migration-3.0.html

[...] * NpgsqlTime has been removed and replaced by the standard .NET TimeSpan.[...]

But LLBLGEN still tries to cast it to .Net System.DateTime! If in LLBLGEN project I trying to change field type in Entity Mapping i'll getting an error:

Message type: Error
Message text: The mapping of sub-element 'TimeFrom' of entity 'sys.OperationTime' for the target database with the driver 'PostgreSql 7.4+ Driver (Npgsql)' has the following errors:
 - TypeConverterToUse: The .NET types of the mapped element field and the target field aren't the same/compatible, so a type converter is needed. 

If I didn't change field mappings manually, I'm getting "System.InvalidCastException occured" in Entity field getter:

get { return (Nullable<System.DateTime>)GetValue((int)OperationTimeFieldIndex.TimeFrom, false); }

In quick watch without casts to DateTime i see that GetValue returns TimeSpan object. See attachment for this.

Can you add type mapping for this or something else to fix this?

Attachments
Filename File size Added on Approval
Clip2net_150827111332.png 9,195 27-Aug-2015 10:15.09 Approved
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Aug-2015 10:30:57   

Ok, so their .NET mapping changed for a couple of types. We'll have to investigate which ones and add some new values to the mapping tables. I have a fixed driver for you later today.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Aug-2015 16:27:58   

I can't find the mapping table on v3 and it doesn't offer a schema table which contains the types either. I'll have to ask them what the type mapping table is. (almost all ado.net providers provide a schema table with the mappings, or at least docs, they have neither it seems. Looking at the code it is arbitrary what types they're using).

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 27-Aug-2015 17:32:17   

I think I have them all now. Mapping tables are rewritten when v3 is used. It's just 2 types (time and timetz, which maps to DateTimeOffset)

See attached dll. You have to refresh the catalogs to get the new types in your project. This kind of sucks, as it gives errors now, so I'd go back to the backup project that's been created before your previous refresh, then refresh with this new driver.

Attachments
Filename File size Added on Approval
HOTFIX_PostgreSqlDBDriver_42_08272015.zip 21,891 27-Aug-2015 17:32.22 Approved
Frans Bouma | Lead developer LLBLGen Pro
Posts: 34
Joined: 22-Oct-2014
# Posted on: 27-Aug-2015 18:16:20   

Otis wrote:

I think I have them all now. Mapping tables are rewritten when v3 is used. It's just 2 types (time and timetz, which maps to DateTimeOffset)

See attached dll. You have to refresh the catalogs to get the new types in your project. This kind of sucks, as it gives errors now, so I'd go back to the backup project that's been created before your previous refresh, then refresh with this new driver.

Thanks! Seems to be working fine now! Thank you for support again!