本文主要向大家介绍了MySQL数据库之EF连接Mysql 表'TableDetails'中的列'IsPrimaryKey'的值为DBNull ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。
无法生成模型,因为存在以下异常:‘System.Data.StrongTypingException:表‘TableDetails‘中的列‘IsPrimaryKey‘的值为DBNull。---> System.InvalidCastException:指定的转换无效。
原文:
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 <>;
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
本文由职坐标整理并发布,希望对同学们学习MySQL有所帮助,更多内容请关注职坐标数据库MySQL数据库频道!