EntityFramework (EF) project to switch the SQLServer database to Mysql step,
1. Download and install packages that support Mysql
1.1 Connector/Net: https://dev.mysql.com/downloads/connector/net/6.9.html
1.2 MySQL for Visual Studio: https://dev.mysql.com/downloads/windows/visualstudio/
2. Upgrade solution EntityFramework version and add Mysql reference
2.1 upgrade EntityFramework in this solution to version 6.0 or later through NuGet
2.2 add Mysql. Data and Mysql. Data. Entity class library references. Note that the Mysql. Data version is 6.9.11. if the version is higher than the version, the class will be used in C.
If the SqlServer version is referenced in the original project, we recommend that you create a new class library and add references to compare the differences between the file generated by App. config for troubleshooting.
3. Change the parameters of the original object model. The steps are as follows (the connection information is black)
4. Change the database connection address in web. Config to the updated Mysql connection address.
5. Solutions to errors
5.1 if an error occurs in step 3 configuration, refer to address: http://blog.csdn.net/niewq/article/details/41877301 for modification.
I personally recommend that you create a new class library, add the EF Entity Data Model, and then modify the reference to the entity class in the project. In this way, the configuration file is free of pollution and troubleshooting is quick.
Error 5.2
Solution:
5.2.1. Run the command in MySQL: use mydbname; set global optimizer_switch = 'derived _ merge = off ';
5.2.2. Restart mysql and regenerate. edmx
6. If the model type reference is added, the old model class in the original code package will be deleted during release.