public ArgsMapper() { Introduction = new GeneralPageBuilder <T>(Commands, Options); Usage = new GeneralPageBuilder <T>(Commands, Options); ValueConverterFactory = new ValueConverterFactory(); OptionValidationService = new OptionValidationService(ValueConverterFactory); CommandValidationService = new CommandValidationService(Settings); SubcommandValidationService = new SubcommandValidationService(Settings); ReflectionService = new ReflectionService(ValueConverterFactory); CommandOptionValidationService = new CommandOptionValidationService(ValueConverterFactory, Settings); }
/// <summary> /// Initializes a new instance of the <see cref="CommandCoordinator">CommandCoordinator</see> /// </summary> /// <param name="commandHandlerManager">A <see cref="ICommandHandlerManager"/> for handling commands</param> /// <param name="commandContextManager">A <see cref="ICommandContextManager"/> for establishing a <see cref="CommandContext"/></param> /// <param name="commandSecurityManager">A <see cref="ICommandSecurityManager"/> for dealing with security and commands</param> /// <param name="commandValidationService">A <see cref="ICommandValidationService"/> for validating a <see cref="ICommand"/> before handling</param> /// <param name="localizer">A <see cref="ILocalizer"/> to use for controlling localization of current thread when handling commands</param> public CommandCoordinator( ICommandHandlerManager commandHandlerManager, ICommandContextManager commandContextManager, ICommandSecurityManager commandSecurityManager, ICommandValidationService commandValidationService, ILocalizer localizer) { _commandHandlerManager = commandHandlerManager; _commandContextManager = commandContextManager; _commandSecurityManager = commandSecurityManager; _commandValidationService = commandValidationService; _localizer = localizer; }
internal ArgsCommandSettings( IArgsMapperSettings argsMapperSettings, ICommandOptionValidationService commandOptionValidationService, ICommandValidationService commandValidationService, ISubcommandValidationService subcommandValidationService, IOptionValidationService optionValidationService, IValueConverterFactory valueConverterFactory) { ArgsMapperSettings = argsMapperSettings; CommandOptionValidationService = commandOptionValidationService; CommandValidationService = commandValidationService; SubcommandValidationService = subcommandValidationService; OptionValidationService = optionValidationService; ValueConverterFactory = valueConverterFactory; Options = new List <Option>(); Subcommands = new List <Command>(); Usage = new CommandPageBuilder <TCommand>(Subcommands, Options); }
/// <summary> /// Create implementation of command validation behavior. /// </summary> /// <param name="validationService">Command validation service.</param> /// <param name="validators">Command validators.</param> public CommandValidationBehaviourImpl(ICommandValidationService validationService, IEnumerable <IValidator <TCommand> > validators) { this.validationService = validationService; this.validationService.AddValidators(validators.OfType <ICommandValidator <TCommand> >().ToArray()); }
/// <summary> /// Create command validation behavior. /// </summary> /// <param name="validationService">Command validation service.</param> /// <param name="validators">Command validators.</param> public CommandValidationBehaviour(ICommandValidationService validationService, IEnumerable <IValidator <TCommand> > validators) { this.validationService = validationService; this.validators = validators.ToArray(); }