EF连接mysql数据库生成实体模型,出现报错无法生成模型:“System.Data.StrongTypingException: 表“TableDetails”中列“IsPrimaryKey”的值为 DBNull

出现如下问题 

 

引用:http://stackoverflow.com/questions/33575109/mysql-entity-the-value-for-column-isprimarykey-in-table-tabledetails-is

1. Open Services (services.msc) and restart MySQL57 service.
2. Execute the following commands in MySQL.
   use <<database name>>;
   set global optimizer_switch='derived_merge=OFF';
3. Update the .edmx.

步骤为:

1、重启mysql服务

2、登录mysql数据库

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

这样就可以了

 

posted @ 2017-03-17 14:22  怪先生  阅读(1842)  评论(0编辑  收藏  举报