"Go" Use EF codefirst to access both MySQL and SQL Server configurations

Source: Internet
Author: User
Tags connectionstrings

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.