コード例 #1
0
 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
               );
     }
 }
コード例 #2
0
 public static ICommandRegistrationContainer Register <T>(this ICommandRegistrationContainer commands)
 {
     return(commands.Register(CommandRegistration.Create <T>()));
 }