public void AddCommand <TDerivedSettings>(string name, Action <IConfigurator <TDerivedSettings> > action)
            where TDerivedSettings : class, TSettings
        {
            var command = new ConfiguredCommand(name, null, typeof(TDerivedSettings));

            action(new Configurator <TDerivedSettings>(command, _registrar));
            _command.Children.Add(command);
        }
示例#2
0
        public void AddCommand <TSettings>(string name, Action <IConfigurator <TSettings> > action)
            where TSettings : class
        {
            var command = new ConfiguredCommand(name, null, typeof(TSettings));

            action(new Configurator <TSettings>(command, _registrar));
            Commands.Add(command);
        }
        public void AddCommand <TCommand>(string name) where TCommand : class, ICommandLimiter <TSettings>
        {
            var settingsType = ConfigurationHelper.GetSettingsType(typeof(TCommand));
            var command      = new ConfiguredCommand(name, typeof(TCommand), settingsType);

            _command.Children.Add(command);

            // Register the command and the settings.
            _registrar?.Register(typeof(ICommand), typeof(TCommand));
            _registrar?.Register(typeof(TCommand), typeof(TCommand));
            _registrar?.Register(settingsType, settingsType);
        }
 public Configurator(ConfiguredCommand command, ITypeRegistrar registrar)
 {
     _command   = command;
     _registrar = registrar;
 }