Bug #59176 Entity Framework edmxgenerator does not set Max Length and Nullable from schema
Submitted: 26 Dec 2010 21:29 Modified: 30 Dec 2010 7:19
Reporter: Tanguy Gilmont Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.3.5 OS:Windows
Assigned to: CPU Architecture:Any

[26 Dec 2010 21:29] Tanguy Gilmont
Description:
Environment:
- Windows 7
- MySql.Data.MySqlClient (connector 6.3.5)
- Visual Studio 2010
- .NET4 (4.0.30319 RTMRel), application is .NET4 Client profile.

When generating an EDM from an existing MySQL database, several properties of the columns are not set, most noticeably
- Max Length (e.g. for strings)
- Nullable

Apparently (but not tested), other values are not set as well:
- Default Value (see bug 53188)
- Fixed Length
- Unicode

How to repeat:
1) Create a table, for example

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

2) Create an empty project in Visual Studio 2010,
3) Add a new ADO.NET Entity Data Model item, generated from a connection to the test database by importing the table above,
4) Check the column properties.

It is also visible in the edmx file, the values are present in the storage model (SSDL) but not in the conceptual model (CSDL).

Suggested fix:
The missing properties mentioned in the description should be set from the columns, in the edmx conceptual model, in order to avoid any loss of information when regenerating a database, or if the user bases their code on those parameters to validate entries.
[30 Dec 2010 7:17] Bogdan Degtyariov
screenshot with properties

Attachment: vs_max_length_nullable.jpg (image/jpeg, text), 159.95 KiB.

[30 Dec 2010 7:19] Bogdan Degtyariov
As per the screenshot in the previous post, none of properties except the name are populated. This actually looks as duplicate of bug 53188, which reports problems with columns metadata.