Bug #64356 *.edmx Generate Database from Model creates incorrect mappings
Submitted: 16 Feb 2012 17:31 Modified: 2 Jul 2012 22:12
Reporter: Simon Mansfield Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:Windows
Assigned to: Roberto Ezequiel Garcia Ballesteros CPU Architecture:Any
Tags: edmx, entity framework, MAPPING

[16 Feb 2012 17:31] Simon Mansfield
Description:
When an entity exists that has a Type "Byte", the database generation creates a script using "tinyint". This when compiled then throws an error:

"Error 2019: Member Mapping specified is not valid. The type 'Edm.Byte[Nullable=True,DefaultValue=]' of member 'X' in type 'A.B' is not compatible with 'MySql.tinyint[Nullable=True,DefaultValue=]'...

So you must change the emdx type to "SByte" for it to work, but then if you try re-generating the database from that you get the error:

"There is no store type corresponding to the EDM type 'Edm.SByte' of primitive type 'SByte'.

How to repeat:
Create an entity with a Byte and generate a database script from that using SSDLToMySQL.tt (VS).

Then compile the program.

Then change the types to SByte and attempt to re-generate.
[2 Jul 2012 22:12] Roberto Ezequiel Garcia Ballesteros
Hi!

Each time a type change is done on an entity property the member mapping needs to be updated. To do this after doing the type change it's required to run “Generate Database from Model…” and click “Finish”. If the script file already exists some overwrite warnings will appear, you need to overwrite the script file, the store schema (SSDL), and the mappings (MSL). Now compile and you will see it updated the model without errors.