MySQL 5.7: System.Data.StrongTypingException when adding or updating an Entity Framework EDMX model
Posted by: Jürgen Bayer
Date: November 07, 2015 08:09AM

I try to get the Entity Framework (5 or 6) working with MySQL 5.7 (database first), but adding an Entity Data Model for a (test) database results in the error "Unexpected exception occured when generating the model. StrongTypingException: The value for column 'IsPrimaryKey' in table TableDetails is DBNull.". The only table in the database has a primary key by the way:

CREATE TABLE `test` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Value` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

I installed MySQL 5.7 with the Developer Default option, meaning that My SQL for Visual Studio 1.2.5 and MySQL Connector 6.9.8 are installed.

In my attempts to get to the source of this issue I tried some combinations:

* MySQL 5.6 with the EF 5 works. I can add, update and use an EDMX model.

* MySQL 5.6 with the EF 6 works partly. When adding an EDMX model the wizard crashes. I can add a model for the EF 5, update EF to 6, install the Nuget package 'MySql.Data.Entity' and update the EDMX model to EF 6. The model works when running the application. But trying to update the model from the database results in an exception.

* After creating an EF 6 model like above and using it on a machine with MySQL 5.7 the model works, but updating (again) results in the StrongTypingException.

I hope that this issue can somehow be solved via some MySQL configuration. I already tried show_compatibility_56=ON on the machine with MySQL 5.7. Did not help.

Would be nice if someone could point me in the right direction. Does anyone have the Entity Framework (6) running with MySQL 5.7?

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.