Mapping Bool mysql data types

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
jallderidge
Posts: 2
Joined: Tue 25 Nov 2008 16:28
Location: Southampton

Mapping Bool mysql data types

Post by jallderidge » Tue 25 Nov 2008 16:39

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 26 Nov 2008 09:44

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

...

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

...
        
...
          
...
        

jallderidge
Posts: 2
Joined: Tue 25 Nov 2008 16:28
Location: Southampton

Changes lost when model updated in Visual Studio

Post by jallderidge » Fri 28 Nov 2008 10:06

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 28 Nov 2008 10:34

We plan to solve this and similar mapping problems, but no details or timeframe can be provided at the moment.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Tue 21 Jun 2011 11:27

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 21 Jun 2011 13:06

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.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Tue 21 Jun 2011 14:47

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...

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 22 Jun 2011 13:20

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.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Wed 22 Jun 2011 13:25

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...

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Any news on this?

Post by Miros » Fri 09 Sep 2011 21:30

I keep running into this thing, is there any news on how to map tinyint columns to bool datatype?

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

Post by Shalex » Tue 13 Sep 2011 13:18

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.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Wed 14 Sep 2011 07:35

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.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Wed 14 Sep 2011 09:25

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...?

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

Post by Shalex » Tue 20 Sep 2011 15:27

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.

Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Post by Miros » Tue 27 Sep 2011 09:50

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?

Post Reply