Esempio n. 1
0
 private CommandParameter(PropertyInfo property)
 {
     Property = property;
     Id       = CommandHelper.GetCommandParameterId(property);
 }
 public CommandRegistrationBuilder Add <TCommand>(Action <CommandRegistration> customize = default) where TCommand : IConsoleCommand
 {
     try
     {
         var registration = new CommandRegistration(_parameterConverter, typeof(TCommand), CommandHelper.GetCommandId(typeof(TCommand)));
         customize?.Invoke(registration);
         _commands.Add(registration);
         return(this);
     }
     catch (Exception inner)
     {
         throw DynamicException.Create
               (
                   $"RegisterCommand",
                   $"An error occured while trying to register '{typeof(TCommand).ToPrettyString()}'. See the inner-exception for details.",
                   inner
               );
     }
 }
Esempio n. 3
0
 public CommandRegistrationBuilder Add <T>() where T : IConsoleCommand
 {
     return(Add((typeof(T), CommandHelper.GetCommandId(typeof(T)), default)));