2

I am trying to generate my model classes from a mysql database schema, with EF6. I use the ado.net wizard database first approach and I get an exception that says :

Unexpected exception occured when generating the model. StrongTypingException:the value for column 'IsPrimaryKey' in table TableDetails is DBNull.

2 Answers 2

5

Run the following command on the MySQL DB and then try if this works.

set global optimizer_switch='derived_merge=off'

0

It seems that the MySQL Entity Framework provider does not work correctly with all combinations of Entity Framework version and MySQL version. I had the same error when trying to create a database first model for MySQL 5.7 and Entity Framework 5 or 6 (tried everything, like with and without adding the MySql.Data.Entity Nuget package). The only success I had was with MySQL 5.6 and Entity Framework 5 (without adding the MySql.Data.Entity Nuget package beforehand).

See also this question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.