[Solved] MySQL Entity Framework: System.Data.StrongTypingException: The value for column IsPrimaryKey

Adnaan
 
on Mar 19, 2018 01:37 AM
4449 Views

Hi,

While using Entity Framework with MySQL, I am getting the following error in edmx.

System.Data.StrongTypingException: The value for column 'IsPrimaryKey' in table 'TableDetails' is DBNull . System.InvalidCastException: Specified cast is not valid.

Please help.

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Mudassar
 
on Mar 19, 2018 01:51 AM

1. Type in Service.msc in Run Command.

2. Once the Servcies App is opened. Look for MySQL57 Service. And restart it.

3. Then open MySQL WorkBench and in your database run the following SQL.

Where AjaxSamples is name of my Database.

 use AjaxSamples;
 set global optimizer_switch='derived_merge=OFF';

4. Restart the MySQL57 Service again.

5. Now in Visual Studio, Right Click and update the edmx and finally save it.

Reference: StackOverFlow