Bugs in ADO.NET Entity Data Model Designer

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
Miros
Posts: 45
Joined: Thu 20 Jan 2011 10:12
Contact:

Bugs in ADO.NET Entity Data Model Designer

Post by Miros » Thu 27 Oct 2011 23:45

Hi there,

I have discovered a couple of bugs in the Enity Data Model Designer.

1) When right clicking and selecting "Generate Database from Model", the DROP TABLE queries correctly use the Entity Name which is in singular form eg. "User", however the CREATE TABLE queries are generated using the Entity Set Name eg. "Users" which is obviously wrong.

2) When right clicking and selecting "Generate Database from Model", Boolean fields are generated as bit(1) fields, when they should map to tinyint(1).

And then a GREAT wish from me: PLEASE look at implementing a method for saving the diagram layout - it is messed up every time I "Update Model from Database".

Thanks in advance.

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 31 Oct 2011 17:12

Miros wrote:1) When right clicking and selecting "Generate Database from Model", the DROP TABLE queries correctly use the Entity Name which is in singular form eg. "User", however the CREATE TABLE queries are generated using the Entity Set Name eg. "Users" which is obviously wrong.
I cannot reproduce the problem with dotConnect for MySQL v 6.50.237. The generated by EDM Wizard script includes "Users" for both DROP and CREATE statements.
Miros wrote:2) When right clicking and selecting "Generate Database from Model", Boolean fields are generated as bit(1) fields, when they should map to tinyint(1).
1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.
2. In case of EDM Wizard, the problem can be fixed in the following way.
Navigate to %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes, open the Devart SSDLToMySql.ttinclude file with any text editor, find the GetDbType method, and replace

Code: Select all

				case "boolean":
					return "bit(1)";
in it with

Code: Select all

				case "boolean":
					return "tinyint(1)";
Save the file.
Miros wrote:And then a GREAT wish from me: PLEASE look at implementing a method for saving the diagram layout - it is messed up every time I "Update Model from Database".
We recommend you using Entity Developer (instead of EDM Designer) because we do not have a technical possibility to change behaviour of EDM Designer, but Entity Developer should save layout correctly.

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

Post by Miros » Thu 03 Nov 2011 13:22

Shalex wrote:
Miros wrote:1) When right clicking and selecting "Generate Database from Model", the DROP TABLE queries correctly use the Entity Name which is in singular form eg. "User", however the CREATE TABLE queries are generated using the Entity Set Name eg. "Users" which is obviously wrong.
I cannot reproduce the problem with dotConnect for MySQL v 6.50.237. The generated by EDM Wizard script includes "Users" for both DROP and CREATE statements.
Miros wrote:2) When right clicking and selecting "Generate Database from Model", Boolean fields are generated as bit(1) fields, when they should map to tinyint(1).
1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.
2. In case of EDM Wizard, the problem can be fixed in the following way.
Navigate to %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes, open the Devart SSDLToMySql.ttinclude file with any text editor, find the GetDbType method, and replace

Code: Select all

				case "boolean":
					return "bit(1)";
in it with

Code: Select all

				case "boolean":
					return "tinyint(1)";
Save the file.
Miros wrote:And then a GREAT wish from me: PLEASE look at implementing a method for saving the diagram layout - it is messed up every time I "Update Model from Database".
We recommend you using Entity Developer (instead of EDM Designer) because we do not have a technical possibility to change behaviour of EDM Designer, but Entity Developer should save layout correctly.
For your info, I am using dotConnect for MySQL v. 6.50.214.0 and Entity Developer v. 4.1.41.

I am using EDM Designer since my model is an ADO.NET Entity Data Model. I am working with Silverlight and Domain Services, where the latter only works with EDM (.edmx) not .edml - why is that by the way??

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

Post by Miros » Thu 03 Nov 2011 13:23

Many thanks for your reply!

For your info, I am using dotConnect for MySQL v. 6.50.214.0 and Entity Developer v. 4.1.41.

I am using EDM Designer since my model is an ADO.NET Entity Data Model. I am working with Silverlight and Domain Services, where the latter only works with EDM (.edmx) not .edml - why is that by the way??

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 04 Nov 2011 15:27


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

Another bug in Entity Developer??

Post by Miros » Thu 01 Dec 2011 00:10

When building a model with Entity Developer and afterwards right-clicking and then selecting "Update Database from Model" or "Generate Database Script from Model", Boolean columns are generated created as BIT columns (see below). I have double checked that my connectionstring contains the "Tiny As Boolean=True" as it should, and I did edit the file %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToMySql.ttinclude as described in this thread.

By the way, what is the status of the bug you said you would follow up on (read in this thread: "1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.")?

Code: Select all

CREATE TABLE Module (
   Id INT NOT NULL AUTO_INCREMENT,
   Name LONGTEXT,
   Description LONGTEXT,
   Note LONGTEXT,
   Type LONGTEXT,
   Disabled BIT,
   PRIMARY KEY (Id)
)
ENGINE = INNODB;

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 01 Dec 2011 18:00

Miros wrote:When building a model with Entity Developer and afterwards right-clicking and then selecting "Update Database from Model" or "Generate Database Script from Model", Boolean columns are generated created as BIT columns (see below).
Miros wrote:By the way, what is the status of the bug you said you would follow up on (read in this thread: "1. We have reproduced the boolean problem with Entity Developer (*.edml). We will post here when it is fixed.")?
These two entries are about the same issue. Could you please explain us why mapping [.NET Boolean -> MySQL BIT] is not suitable for you? There is a single-valued correspondence between these two types.
Miros wrote:I have double checked that my connectionstring contains the "Tiny As Boolean=True" as it should
The "Tiny As Boolean=True" connection string parameter is taken into account only in the Database First approach.
"Generate Database Script from Model" is configured to not depend on connection string settings.
Miros wrote:I did edit the file %Program Files%\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToMySql.ttinclude as described in this thread.
This setting changes behaviour of EDM Wizard (not Entity Developer).

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

Post by Miros » Thu 01 Dec 2011 21:53

Hi again and thanks for your reply - I understand your points.

The reason why the BIT type is not good, is discussed many places, here for example: http://www.xaprb.com/blog/2006/04/11/bi ... -in-mysql/. Read carefully the section "History".

One concrete problem I face in this context is that BIT type doesn't work with PHPMyAdmin - I don't know if it is a bug in MySQL (version 5.0.32) or PHPMyAdmin (version 2.9.1.1-Debian-9). For example it doesn't seem to be possible to insert/update data in BIT columns using the web interface.

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 05 Dec 2011 13:58

We are investigating the issue. We will post here about the results.

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 17 Jan 2012 17:40

Starting from the next build of dotConnect for MySQL, the behaviour will be changed: the TINYINT(1) data type will be used for the columns which correspond to the System.Boolean properties. We will notify you when the corresponding version is available for download.

Shalex
Devart Team
Posts: 8033
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 27 Jan 2012 13:48

New version of dotConnect for MySQL 6.70 is released!
It can be downloaded from http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23259 .

Post Reply