The actual requirements in the project, you need to write a gadget to import the original SQL Server old database into the MySQL database on the new system at timed time.
1, EF entity file generation not to mention, there is no need to pay attention to the place
2. References
3. Configuration files
<connectionStrings> <!--Mysql - <Addname= "Statisticcontext"connectionString= "Data source=192.168.1.233;port=3306;initial catalog=statistic2016;user id=root;password=root;"ProviderName= "MySql.Data.MySqlClient" /> <!--SQL Server - <Addname= "Djg_resmodel"connectionString= "Data source=192.168.1.218;initial catalog=res_djg;persist security Info=true;user id=sa;password=root-001; Multipleactiveresultsets=true;application name=entityframework "ProviderName= "System.Data.SqlClient" /> </connectionStrings>
4. Drive Configuration
<configsections> <!--for more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 - < Sectionname= "EntityFramework"type= "System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, version=6.0.0.0, culture= Neutral, publickeytoken=b77a5c561934e089 "requirepermission= "false" /> </configsections><EntityFramework> <defaultconnectionfactorytype= "System.Data.Entity.Infrastructure.LocalDbConnectionFactory, entityframework"> <Parameters> <parametervalue= "Mssqllocaldb" /> </Parameters> </defaultconnectionfactory> <providers> <providerInvariantName= "System.Data.SqlClient"type= "System.Data.Entity.SqlServer.SqlProviderServices, entityframework.sqlserver" /> <providerInvariantName= "MySql.Data.MySqlClient"type= "MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, version=6.9.9.0, Culture=neutral, Publickeytoken=c5687fc88969c44d "></provider> </providers> </EntityFramework><System.Data> <dbproviderfactories> <Removeinvariant= "MySql.Data.MySqlClient" /> <Addname= "MySQL Data Provider"invariant= "MySql.Data.MySqlClient"Description= ". Net Framework Data Provider for MySQL"type= "MySql.Data.MySqlClient.MySqlClientFactory, Mysql.data, version=6.9.9.0, Culture=neutral, publickeytoken= C5687fc88969c44d " /> </dbproviderfactories> </System.Data>
原文地址:
https://my.oschina.net/ligenhua/blog/824043?nocache=1493803818033
"Go" Use EF codefirst to access both MySQL and SQL Server configurations