Beispiel #1
0
        private void RegisterNonGenericCommandInternal <TCommand>(CommandLineCommand <TOption, object> command)
            where TCommand : Abstractions.Command.Command
        {
            var cmdConfigurator = ActivatorUtilities.GetServiceOrCreateInstance <TCommand>(m_serviceProvider);

            cmdConfigurator.OnConfigure(command);

            command.OnExecuting(cmdConfigurator.OnExecute);
            command.OnExecutingAsync(cmdConfigurator.OnExecuteAsync);
        }
Beispiel #2
0
        private void RegisterGenericCommandInternal <TCommand>(CommandLineCommand <TOption, object> command)
            where TCommand : Abstractions.Command.Command
        {
            var cmdConfigurator = (Command <TOption>)(Abstractions.Command.Command)(ActivatorUtilities.GetServiceOrCreateInstance <TCommand>(m_serviceProvider));

            cmdConfigurator.OnConfigure(command);

            command.OnExecuting((Action <TOption>)cmdConfigurator.OnExecute);
            command.OnExecutingAsync((Func <TOption, CancellationToken, Task>)cmdConfigurator.OnExecuteAsync);
        }