EF's codefrist operation MySQL is prepared in advance:
1. Install two packages: Mysql.data and MySql.Data.Entity, add 2 packages to the Package Manager in vs. (Note required VS2015, and EF6 support);
2. Install MySQL, and configure the roles and permissions, it is best to install NAVICAT premium for easy viewing and management.
Once you're ready, just change the original EF operation Sqlservce Base above:
1. Modify the configuration connector
<add name="defaultconnection" connectionstring="data source=.; Initial Catalog=xxoo; Uid=xxoo; Pwd=xxoo "providername="MySql.Data.MySqlClient "/>
Remember the type is MySql.Data.MySqlClient
2. Configure the data source type in context operations
/// <summary> /// Data Set Configuration class /// </summary> [Dbconfigurationtype (typeof(mysqlefconfiguration))] Public Sealed class Dbcontexthelper:dbcontext {}
EF operation MySQL