Entity Framework鏈接MySQL時:因爲出現如下異常,沒法生成模型:「表「TableDetails」中列「IsPrimaryKey」的值爲DBNull.

解決辦法一:mysql

1.cmdsql

2.c:\Users\Administrator>cd c:\Program Files\MySQL\MySQL Server 5.7\bin數據庫

3c:\Program Files\MySQL\MySQL Server 5.7\bin>mysql -h localhost -u root -pspa

4.Enter password: 數據庫密碼code

5.use  表名; cmd

6.set global optimizer_switch='derived_merge=OFF';it

7.終於成功!class

 

 

解決辦法二:service

1. 運行services.msc,重啓MySQL服務.
2.MySQL運行一下命令: use mydbname; set global optimizer_switch='derived_merge=OFF';
3. 從新生成 .edmx
相關文章
相關標籤/搜索