示例#1
0
        public async static Task MainAsync(string[] args)
        {
            var sourceDb      = new SourceDatabase();
            var destinationDb = new DestinationDatabase();
            var tables        = await sourceDb.GetTableNames();

            var migrationTable = tables.FirstOrDefault(x => x.Name == "__MigrationHistory");

            tables.Remove(migrationTable);
            //await destinationDb.DeleteTables(tables);
            //await destinationDb.CreateTables(tables);

            var copyData  = new CopyData(sourceDb, destinationDb);
            var startTime = DateTime.Now;

            foreach (Table table in tables)
            {
                await copyData.CopyTable(table);
            }
            var endtime = DateTime.Now;

            Console.WriteLine(endtime.Subtract(startTime));
            Console.ReadLine();
        }
示例#2
0
 public CopyData(SourceDatabase source, DestinationDatabase destination, int batchSize = 262)
 {
     _sourceDB      = source;
     _destinationDB = destination;
     _batchSize     = batchSize;
 }