无法生成模型,因为存在以下异常:‘System.Data.StrongTypingException:表‘TableDetails‘中的列‘IsPrimaryKey‘的值为DBNull。---> System.InvalidCastException:指定的转换无效。
原文链接http://stackoverflow.com/questions/33575109/mysql-entity-the-value-for-column-isprimarykey-in-table-tabledetails-is
原文:
Entity Framework (version 6.1.3) and MySQL Server (>= 5.7.6)
One way to resolve the issue 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.
It‘s a late reply. But hope it will help somebody.
Thanks.
大致翻译:
1.重新启动mysql服务
2.打开命令列界面
set global optimizer_switch=‘derived_merge=OFF‘;
3.重新新建EF
EF连接Mysql 表'TableDetails'中的列'IsPrimaryKey'的值为DBNull
时间: 2024-12-25 10:13:48