MariaDb (MySql) model with Guid <-> VarBinary fields

Posts   
 
    
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 15-May-2014 09:14:57   

Hello,

I am using latest LLBLGen Pro (4.1 Final). Project uses MariaDb (MySql) 10.0 database with DevArt MySQL connector. Using model first scenario.

I am trying to create entities having System.Guid fields in entities and VarBinary(36) in database. I read about type converter concept. I have seen there is one system converter GuidByteArrayConverter. Also tried to write my own.

However I am not able to get these converters for concrete fields (its not even listed in Field mapping grid). I tried also to add in Project settings (Type conversions) a new converter definition, however in the Add New dialog field "Rel. model .NET data type" does not have System.Guid listed at all.

Any advice on this? We will have lots of such fields, so automatic converter mapping would be really helpful.

with best regards Mantas

cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 15-May-2014 10:30:39   

There are few other problems I am facing: 1. If I choose System.Guid as property type, there is no automatic mapping to db field (I need to create db type mapping manually) 2. When generating DDL create script, PK (Integer) field is not marked as AUTO_INCREMENT

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-May-2014 07:21:30   

Hi Mantas

cerberis wrote:

However I am not able to get these converters for concrete fields (its not even listed in Field mapping grid). I tried also to add in Project settings (Type conversions) a new converter definition, however in the Add New dialog field "Rel. model .NET data type" does not have System.Guid listed at all.

Any advice on this?

These are the built-in type converters. Try DB type char[32] instead, and use GuidStringConverter,

cerberis wrote:

We will have lots of such fields, so automatic converter mapping would be really helpful.

You can. You have to define the automatic conversion in Project->Settings->Type Converter Definitions, you can filter on various parameters, for instance, only DB type Varchar of length 32. You also have to set Project->Settings->General->Auto assign type converter to field mapping to true. I attached an image to show those settings.

Attachments
Filename File size Added on Approval
typeConversion.png 65,041 16-May-2014 07:23.16 Approved
David Elizondo | LLBLGen Support Team
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 16-May-2014 13:33:45   

If I have char[] this works. However I would like to have binary or varbinary instead. Is this not supported?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-May-2014 14:53:19   

Yes, it is supported, we do have a Guid <-> byte[] converter. I can reproduce your problem though: mapping a guid typed field on a byte[] field in mysql doesn't enlist the type converter. I'll see why this is.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-May-2014 15:03:41   

Looks like a bug in the system type converters dll, as it has 'Byte[]' as core type listed for GuidByteArray converter which is wrong, it should be 'Guid' as that's the core type. Looking into fixing it.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 16-May-2014 15:13:46   

Fixed. Please copy the attached dll in the folder as administrator: <llblgen pro installation folder>\TypeConverters

overwriting the existing file, restart the designer, it should then be selectable.

Attachments
Filename File size Added on Approval
SD.LLBLGen.Pro.TypeConverters.dll 20,480 16-May-2014 15:13.54 Approved
Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 17-May-2014 18:22:56   

Thank you, for such a fast fix. However after replacing dll it seems that projects are not loaded anymore. LLBLGen designer shows a meesage:

Reference to missing type converter found

While loading the project the following type converter related error occured: A reference to the type converter 'SD.LLBLGen.Pro.TypeConverters.GuidStringConverter' was found, however this typeconverter wasn't loaded / found This is likely due to the project file refering to an additional type converter folder which either doesn't exist or doesn't contain a type converter dll with the type converter referenced. As a missing type converter results in all fields using the missing type converter having their types reset to string, LLBLGen Pro has aborted the project load. Do you want to specify the additional type converter folder for this project and retry? Click 'Yes' if you do, otherwise click 'No' to abort the load action. Be aware that the selected folder will be set as 'AdditionalTypeConverterFolder' in the project properties of this project, so you should save the project after it's successfully loaded.

regards Mantas

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-May-2014 10:58:12   

Hmm. If you open the designer and go to Tools -> View Loaded external types, is it listed there?

In application output I can see the type converter loaded just fine... Strange!

If the type converter is loaded, please create a helpdesk thread and attach your project so we can try to reproduce it.

Also, it might be due to security in windows: you did copy the file as administrator, I presume? In any case, right-click the dll in the TaskPerformers folder and select 'Unblock' (if present)

Frans Bouma | Lead developer LLBLGen Pro
cerberis
User
Posts: 93
Joined: 20-May-2011
# Posted on: 19-May-2014 09:31:13   

Sorry, completely forgot about that windows blocking issue. Unblock did the trick. I can see now GuidByteArrayConverter. Thank you.