Anyone working on .Net application with MySql 5.7 and EF in Db First Approach would have come across what is an officially confirmed bug. This bug rises when you attempt to generate/update your Entity Model after changes to the Database.
“Unable to generate the model because of the following exception: ‘System.Data.StrongTypingException: The value for column ‘IsPrimaryKey’ in table ‘TableDetails’ is DBNull. —> System.InvalidCastException:”
The workaround you need to do to fix this one
- Open your Workbench and execute following commands on your Db.
set global optimizer_switch='derived_merge=off'; set optimizer_switch='derived_merge=off';
- Close your workbench ( you might have to restart your visual studio as well ).
- Generate/Update your model.