Пример #1
0
        public static async Task Main(string[] args)
        {
            var commandLineParser = Parser.Default.ParseArguments <CommandLineOptions>(args);

            if (commandLineParser.Tag != ParserResultType.Parsed)
            {
                return;
            }

            var commandLineOptions = ((Parsed <CommandLineOptions>)commandLineParser).Value;

            if (commandLineOptions.InstanceId >= commandLineOptions.TotalInstances)
            {
                throw new ArgumentException(
                          $"InstanceId: {commandLineOptions.InstanceId} is invalid. Cannot exceed total instances {commandLineOptions.TotalInstances}");
            }

            var logger = CreateLogger(commandLineOptions);

            logger.Information("{@commandLineOptions}", commandLineOptions);

            var neo4j    = new Neo4j(logger);
            var cache    = new Cache(commandLineOptions.ShouldRestart);
            var cosmosDb = new CosmosDb(logger);

            using var migrator = new Migrator(commandLineOptions, logger, neo4j, cache, cosmosDb);
            await migrator.MigrateAsync();
        }
Пример #2
0
 public Migrator(CommandLineOptions commandLineOptions, Serilog.ILogger logger,
                 Neo4j neo4j, Cache cache, CosmosDb cosmosDb)
 {
     _commandLineOptions = commandLineOptions;
     _logger             = logger;
     _neo4j    = neo4j;
     _cache    = cache;
     _cosmosDb = cosmosDb;
 }