public Migrator(MigratorConfig config, ILogger logger) { _sourceConnString = config.SourceConnection; _destinationConnString = config.DestinationConnection; _tables = config.Tables; _batchNumber = config.BatchNumber; _logger = logger; }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); var config = new MigratorConfig { SourceConnection = Configuration.GetConnectionString("SourceConnection"), DestinationConnection = Configuration.GetConnectionString("DestinationConnection"), BatchNumber = Configuration.GetValue <int>("BatchNumber"), Tables = Configuration.GetSection("Tables").AsEnumerable().Select(t => t.Value).Where(t => !string.IsNullOrEmpty(t)) }; var migrator = new Migrator(config, _logger); await migrator.Start(false, stoppingToken); _logger.LogInformation("Bye!"); }