轻量ORM-SqlRepoEx (八)MySQL、Sql Service 迁移

数据库变更在编程应用中是常的,MySQL、Sql Service之间的数据迁移更为常见,在 SqlRepoEx2.0DemoForAspCore 中演示了,这种数据库之间切换时SqlRepoEx是如何的简单。中演示了,这种数据库之间切换时SqlRepoEx是如何的简单。

第一步、增加SqlRepoEx.MySql.ServiceCollection的Nuget引用;

第二步、更改Startup.cs文件中

      using SqlRepoEx.MsSql.ServiceCollection;

     using SqlRepoEx.MySql.ServiceCollection;

第三步、更改ConnectionString 字串为 string ConnectionString = "datasource=127.0.0.1;username=test;password=test;database=northwind;charset=gb2312;SslMode = none;";


            然后,就没了

就这么简单,其他的不用改

就这么简单,其他的不用改

就这么简单,其他的不用改

 

 

为演示代码,我在MySql中增加了`customers` 个,其结构与数据与Northwind数据库Customers表相同。

源码见:

https://gitee.com/azthinker/SqlRepoEx2.0DemoForAspCore

https://github.com/AzThinker/SqlRepoEx2.0DemoForAspCore

 

posted @ 2018-10-10 12:32  Tikyang  阅读(286)  评论(0编辑  收藏  举报