VS2015+EF+MySql问题

1.出现框架不兼容问题:

 

解决方法:a.在web.config或者app.config中加入所示代码:

 

b.引用mysqlConnector.net中的所有dll,一般路径在D:Program Files (x86)MySQLConnector.NET 6.9Assembliesv4.5中:

 

c.是否重新生成了项目

2.出现类型映射错误:

 

可以用以下命令解决:

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.

3.出现codefirst模式错误:

 

仔细检查连接字符串是否为EF要求的连接字符串。

原文地址:https://www.cnblogs.com/zhoushiya/p/12107624.html