예제 #1
0
        public ApplyCommand(
            ISchemaManager schemaManager,
            ILogger <ApplyCommand> logger)
            : base(CommandNames.Apply, Resources.ApplyCommandDescription)
        {
            AddOption(CommandOptions.ConnectionStringOption());
            AddOption(CommandOptions.ServerOption());
            AddOption(CommandOptions.VersionOption());
            AddOption(CommandOptions.NextOption());
            AddOption(CommandOptions.LatestOption());
            AddOption(CommandOptions.ForceOption());

            Handler = CommandHandler.Create(
                (string connectionString, Uri server, MutuallyExclusiveType type, bool force, CancellationToken token)
                => HandlerAsync(connectionString, server, type, force, token));

            Argument.AddValidator(symbol => RequiredOptionValidator.Validate(symbol, CommandOptions.ConnectionStringOption(), Resources.ConnectionStringRequiredValidation));
            Argument.AddValidator(symbol => RequiredOptionValidator.Validate(symbol, CommandOptions.ServerOption(), Resources.ServerRequiredValidation));
            Argument.AddValidator(symbol => MutuallyExclusiveOptionValidator.Validate(symbol, new List <Option> {
                CommandOptions.VersionOption(), CommandOptions.NextOption(), CommandOptions.LatestOption()
            }, Resources.MutuallyExclusiveValidation));

            EnsureArg.IsNotNull(logger, nameof(logger));
            EnsureArg.IsNotNull(schemaManager, nameof(schemaManager));

            _logger        = logger;
            _schemaManager = schemaManager;
        }
예제 #2
0
        public ApplyCommand(
            SqlServerDataStoreConfiguration sqlServerDataStoreConfiguration,
            BaseSchemaRunner baseSchemaRunner,
            ISchemaManagerDataStore schemaManagerDataStore,
            ISchemaClient schemaClient)
            : base(CommandNames.Apply, Resources.ApplyCommandDescription)
        {
            AddOption(CommandOptions.ConnectionStringOption());
            AddOption(CommandOptions.ServerOption());
            AddOption(CommandOptions.VersionOption());
            AddOption(CommandOptions.NextOption());
            AddOption(CommandOptions.LatestOption());
            AddOption(CommandOptions.ForceOption());

            Handler = CommandHandler.Create(
                (string connectionString, Uri server, MutuallyExclusiveType type, bool force, CancellationToken token)
                => HandlerAsync(connectionString, server, type, force, token));

            Argument.AddValidator(symbol => Validators.RequiredOptionValidator.Validate(symbol, CommandOptions.ConnectionStringOption(), Resources.ConnectionStringRequiredValidation));
            Argument.AddValidator(symbol => Validators.RequiredOptionValidator.Validate(symbol, CommandOptions.ServerOption(), Resources.ServerRequiredValidation));
            Argument.AddValidator(symbol => Validators.MutuallyExclusiveOptionValidator.Validate(symbol, new List <Option> {
                CommandOptions.VersionOption(), CommandOptions.NextOption(), CommandOptions.LatestOption()
            }, Resources.MutuallyExclusiveValidation));

            EnsureArg.IsNotNull(sqlServerDataStoreConfiguration);
            EnsureArg.IsNotNull(baseSchemaRunner);
            EnsureArg.IsNotNull(schemaManagerDataStore);
            EnsureArg.IsNotNull(schemaClient);

            _sqlServerDataStoreConfiguration = sqlServerDataStoreConfiguration;
            _baseSchemaRunner       = baseSchemaRunner;
            _schemaManagerDataStore = schemaManagerDataStore;
            _schemaClient           = schemaClient;
        }
예제 #3
0
        public CurrentCommand(ISchemaManager schemaManager)
            : base(CommandNames.Current, Resources.CurrentCommandDescription)
        {
            AddOption(CommandOptions.ServerOption());
            AddOption(CommandOptions.ConnectionStringOption());

            Handler = CommandHandler.Create(
                (InvocationContext context, Uri server, string connectionString, CancellationToken token)
                => HandlerAsync(context, connectionString, server, token));

            Argument.AddValidator(symbol => RequiredOptionValidator.Validate(symbol, CommandOptions.ConnectionStringOption(), Resources.ConnectionStringRequiredValidation));
            Argument.AddValidator(symbol => RequiredOptionValidator.Validate(symbol, CommandOptions.ServerOption(), Resources.ServerRequiredValidation));

            EnsureArg.IsNotNull(schemaManager, nameof(schemaManager));

            _schemaManager = schemaManager;
        }
예제 #4
0
        public CurrentCommand(
            BaseSchemaRunner baseSchemaRunner,
            SqlServerDataStoreConfiguration sqlServerDataStore,
            ISchemaClient schemaClient)
            : base(CommandNames.Current, Resources.CurrentCommandDescription)
        {
            AddOption(CommandOptions.ServerOption());
            AddOption(CommandOptions.ConnectionStringOption());

            Handler = CommandHandler.Create(
                (InvocationContext context, Uri server, string connectionString, CancellationToken token)
                => HandlerAsync(context, server, connectionString, token));

            Argument.AddValidator(symbol => Validators.RequiredOptionValidator.Validate(symbol, CommandOptions.ConnectionStringOption(), Resources.ConnectionStringRequiredValidation));
            Argument.AddValidator(symbol => Validators.RequiredOptionValidator.Validate(symbol, CommandOptions.ServerOption(), Resources.ServerRequiredValidation));

            EnsureArg.IsNotNull(baseSchemaRunner);
            EnsureArg.IsNotNull(sqlServerDataStore);
            EnsureArg.IsNotNull(schemaClient);

            _baseSchemaRunner   = baseSchemaRunner;
            _sqlServerDataStore = sqlServerDataStore;
            _schemaClient       = schemaClient;
        }