Page 1 of 2

Mapping Bool mysql data types

Posted: Tue 25 Nov 2008 16:39
by jallderidge
There appears to be an issue when mapping mysql bool ( tinyint(1) ) data types. The following error is displayed in visual studio when compiling the model:

Code: Select all

Error	1	Error 2019: Member Mapping specified is not valid. The type 'Edm.Boolean[Nullable=False,DefaultValue=False]' of member 'IsPhysical' in type 'VisuLiveContext.Dashboard' is not compatible with 'Devart.Data.MySql.sbyte[Nullable=False,DefaultValue=]' of member 'IsPhysical'
Is there any way of having a code boolean property?

Posted: Wed 26 Nov 2008 09:44
by AndreyR
For proper work of mapping tinyint(1) to boolean you should manually (with XML Editor) edit the type of property in both SSDL and CSDL contents of the .edmx file, like in the following example:

Code: Select all

...

...
        
...
          
...
        
...

...
        
...
          
...
        

Changes lost when model updated in Visual Studio

Posted: Fri 28 Nov 2008 10:06
by jallderidge
Thanks, that works.

The only issue is that each time the model is updated in Visual Studio the mapping is changed back to sbyte.

Is there a plan to add a converter for sbyte to boolean so that the manual fix isn't required?

Posted: Fri 28 Nov 2008 10:34
by AndreyR
We plan to solve this and similar mapping problems, but no details or timeframe can be provided at the moment.

Posted: Tue 21 Jun 2011 11:27
by Miros
AndreyR wrote:We plan to solve this and similar mapping problems, but no details or timeframe can be provided at the moment.
Has this been solved, and if so, how do I go about setting it up?

Posted: Tue 21 Jun 2011 13:06
by AndreyR
We have added Devart Entity model Visual Studio Item Template. It is edited in Entity Developer for dotConnect.
The Update from Database wizard for Devart Entity models does not influence the properties of the entities that were not selected in the wizard, so the type will persist. The Professional and Developer editions of dotConnect for MySQL contain Entity Developer for dotConnect.

Posted: Tue 21 Jun 2011 14:47
by Miros
AndreyR wrote:We have added Devart Entity model Visual Studio Item Template. It is edited in Entity Developer for dotConnect.
The Update from Database wizard for Devart Entity models does not influence the properties of the entities that were not selected in the wizard, so the type will persist. The Professional and Developer editions of dotConnect for MySQL contain Entity Developer for dotConnect.
Sorry, maybe I am slow here, but is it possible to setup generally for the entire model that tinyint(1) should be converted to System.Boolean?

I have looked many places, but cannot find it...

And by the way I have the Professional edition...

Posted: Wed 22 Jun 2011 13:20
by AndreyR
We are investigating whether it is possible to add some functionality, so that TinyInt properties can be added as Boolean properties in Entity Developer.
I will let you know about the results of our investigation.

Posted: Wed 22 Jun 2011 13:25
by Miros
AndreyR wrote:We are investigating whether it is possible to add some functionality, so that TinyInt properties can be added as Boolean properties in Entity Developer.
I will let you know about the results of our investigation.
OK, Maybe as a part of your brilliant wizard, it would be nice to be able to "override" standards for type mappings...

Any news on this?

Posted: Fri 09 Sep 2011 21:30
by Miros
I keep running into this thing, is there any news on how to map tinyint columns to bool datatype?

Posted: Tue 13 Sep 2011 13:18
by Shalex
The TINYINT(1) to Boolean mapping in Entity Data Model Wizard/Update From Database Wizard when connection string includes "Tiny As Boolean=true;" is supported starting from the 6.30.196 version (28-Jul-2011) of dotConnect for MySQL. We recommend you to upgrade to the latest (6.50.214) version.

Posted: Wed 14 Sep 2011 07:35
by Miros
Shalex wrote:The TINYINT(1) to Boolean mapping in Entity Data Model Wizard/Update From Database Wizard when connection string includes "Tiny As Boolean=true;" is supported starting from the 6.30.196 version (28-Jul-2011) of dotConnect for MySQL. We recommend you to upgrade to the latest (6.50.214) version.
Sounds good, I will try it right away.

Posted: Wed 14 Sep 2011 09:25
by Miros
Shalex wrote:The TINYINT(1) to Boolean mapping in Entity Data Model Wizard/Update From Database Wizard when connection string includes "Tiny As Boolean=true;" is supported starting from the 6.30.196 version (28-Jul-2011) of dotConnect for MySQL. We recommend you to upgrade to the latest (6.50.214) version.
Hi again, I've made a small test, but I get the exception "Invalid datatype: BOOLEAN" when querying the database...

It seems that the tinyint is converted to an object, not a "real" boolean...?

Posted: Tue 20 Sep 2011 15:27
by Shalex
I have checked the 6.50.214 version of dotConnect for MySQL: boolean values are inserted to the database and retrieved back via my ObjectConext descendant successfully.

1. Please specify your current version (x.xx.xxx) of dotConnect for MySQL. You can find it in the Tools > MySQL > About menu of Visual Studio.
2. Send us a small test project with the corresponding DDL/DML script to reproduce the problem in our environment.

Posted: Tue 27 Sep 2011 09:50
by Miros
Shalex wrote:The TINYINT(1) to Boolean mapping in Entity Data Model Wizard/Update From Database Wizard when connection string includes "Tiny As Boolean=true;" is supported starting from the 6.30.196 version (28-Jul-2011) of dotConnect for MySQL. We recommend you to upgrade to the latest (6.50.214) version.
Is it possible to add a property to the connection string, making table names capitalized in the Entity Data Model (.edmx) - like in the wizard for the LinqConnect Model?