private void RegisterNonGenericCommandInternal <TCommand>(CommandLineCommand <TOption, object> command) where TCommand : Command { var cmdConfigurator = ActivatorUtilities.GetServiceOrCreateInstance <TCommand>(Services); cmdConfigurator.OnConfigure(command); command.OnExecuting(cmdConfigurator.OnExecute); command.OnExecutingAsync(cmdConfigurator.OnExecuteAsync); }
private void RegisterGenericCommandInternal <TCommand>(CommandLineCommand <TOption, object> command) where TCommand : Command { var cmdConfigurator = (Command <TOption>)(Command)(ActivatorUtilities.GetServiceOrCreateInstance <TCommand>(Services)); cmdConfigurator.OnConfigure(command); command.OnExecuting((Action <TOption>)cmdConfigurator.OnExecute); command.OnExecutingAsync((Func <TOption, CancellationToken, Task>)cmdConfigurator.OnExecuteAsync); }