EntityFrameworkCore.DBCopy 1.0.6

dotnet add package EntityFrameworkCore.DBCopy --version 1.0.6
NuGet\Install-Package EntityFrameworkCore.DBCopy -Version 1.0.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EntityFrameworkCore.DBCopy" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EntityFrameworkCore.DBCopy --version 1.0.6
#r "nuget: EntityFrameworkCore.DBCopy, 1.0.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EntityFrameworkCore.DBCopy as a Cake Addin
#addin nuget:?package=EntityFrameworkCore.DBCopy&version=1.0.6

// Install EntityFrameworkCore.DBCopy as a Cake Tool
#tool nuget:?package=EntityFrameworkCore.DBCopy&version=1.0.6

Build status

EntityFrameworkCore.DBCopy

Copy database using EFcore This is a library for transferring data between different databases,Even databases of different structures.

Before use this

Prepare the migration files for the destination database,An easy way is to inherit your Dbcontext.

 public class AAContext : DbContext
 {
    //you use this Context,like sql server
 }
 
  public class MysqlAAContext : AAContext
 {
    //this Context is using to Mysql
 }
 
  public class PostgresqlAAContext : AAContext
 {
    //this Context is using to Postgresql
 }

Update your IDesignTimeDbContextFactory <br>

///Default factory
  public class AAContextContextFactory : IDesignTimeDbContextFactory<AAContext>
   {
    
       public AAContext CreateDbContext(string[] args)
       {
           var builder = new DbContextOptionsBuilder<AAContext>();
           builder.UseSqlServer(connectionString);

           return new AAContext(builder.Options);
       }
   }
   ///New factory
  public class MysqlAAContextContextFactory : IDesignTimeDbContextFactory<MysqlAAContext>
   {
    
       public MysqlAAContext CreateDbContext(string[] args)
       {
           var builder = new DbContextOptionsBuilder<MysqlAAContext>();
           builder.UseMySql(connectionString);

           return new MysqlAAContext(builder.Options);
       }
   }

Then call

   dotnet ef migrations add xxx --context MysqlAAContext --output-dir Migrations/MySqlMigrations --project xxxEntityFrameworkCore --startup-project xxx
   dotnet ef database update  --context MysqlAAContext --project xxxEntityFrameworkCore --startup-project xxx

Use this library

  var fromoptionsBuilder = new DbContextOptionsBuilder<AAContext>();
      fromoptionsBuilder.UseSqlServer(xxxx);
  var tooptionsBuilder = new DbContextOptionsBuilder<AAContext>();
      tooptionsBuilder.UseMySql(xxxx);
  var fromdboption = fromoptionsBuilder.Options;
  var todboption = tooptionsBuilder.Options;
  var copy = new DBCopyWorker<SkuContext>(fromdboption, todboption);
      copy.Copy();

Limit

This repository use

Entity Framework Extensions

to bulkinsert. It is not free,but you can get free trial.I will replace this in the funture!

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.6 558 3/17/2020
1.0.5 485 3/17/2020
1.0.4 417 3/16/2020
1.0.0 442 3/16/2020