public static void Perform(string[] args, DatabaseConnectionProperties databaseProperties, SyrinxProperties syrinxProperties, Assembly assembly, Action <IServiceCollection> serviceHandler = null) { var parser = new Parser(settings => settings.CaseInsensitiveEnumValues = true); parser.ParseArguments <CamundaDeploymentToolOptions>(args) .WithParsed(options => { var serviceCollection = CreateServices(databaseProperties, syrinxProperties, assembly); serviceHandler?.Invoke(serviceCollection); using var scope = serviceCollection.BuildServiceProvider(false).CreateScope(); var service = scope.ServiceProvider.GetRequiredService <ICamundaDeploymentService>(); switch (options.Action) { case MigrationAction.Upgrade: service.Upgrade(); break; case MigrationAction.Rollback: service.DowngradeToPrevious(); break; case MigrationAction.Downgrade: service.Downgrade(); break; default: throw CommonExceptions.CamundaCouldNotBeDeployed(); } }) .WithNotParsed(_ => throw CommonExceptions.CamundaCouldNotBeDeployed()); }