示例#1
0
 public void ConfigureCommandServices(ICommandServicesContext <TParameters> context, IServiceCollection services)
 {
     foreach (var configurator in CommandServicesConfiguration)
     {
         configurator.Invoke(context, services);
     }
 }
#pragma warning disable CA1801
        private async Task <int> BuildAndRunCommand(
            IPluginConfigurationContext buildContext,
            CommandLineApplication command,
            IConfigurationRoot commandConfiguration,
            IServiceProvider scopeServiceProvider,
            ICommandServicesContext commandServicesContext,
            CancellationToken cancellationToken)
        {
            var commandContext = new CommandContext(
                commandServicesContext.HostConfiguration,
                commandServicesContext.HostServices,
                commandConfiguration,
                scopeServiceProvider,
                command);

            var commandInstance = scopeServiceProvider.GetRequiredService <ICommand>();

            return(await commandInstance.RunAsync(commandContext, cancellationToken));
        }
 public virtual void ConfigureCommandServices(ICommandServicesContext context, IServiceCollection services)
 {
 }