Example #1
0
        // end-snippet

        public AppConfig(AppSettings appSettings, IConsole console,
                         IEnvironment environment,
                         IDependencyResolver?dependencyResolver, IHelpProvider helpProvider,
                         NameTransformation?nameTransformation, Action <OnRunCompletedEventArgs>?onRunCompleted,
                         TokenizationEvents tokenizationEvents, BuildEvents buildEvents, IServices services,
                         Dictionary <Type, Func <CommandContext, object> > parameterResolversByType,
                         ExecutionMiddleware[] middlewarePipeline, TokenTransformation[] tokenTransformations)
        {
            AppSettings              = appSettings;
            Console                  = console;
            Environment              = environment;
            DependencyResolver       = dependencyResolver;
            HelpProvider             = helpProvider;
            NameTransformation       = nameTransformation ?? ((_, memberName, overrideName, _) => overrideName ?? memberName);
            OnRunCompleted           = onRunCompleted;
            TokenizationEvents       = tokenizationEvents;
            BuildEvents              = buildEvents;
            Services                 = services;
            ParameterResolversByType = parameterResolversByType;
            MiddlewarePipeline       = middlewarePipeline;
            TokenTransformations     = tokenTransformations;

            ResolverService = services.GetOrAdd(() => new ResolverService());
            ResolverService.BackingResolver = dependencyResolver;
            OnRunCompleted += args => ResolverService.OnRunCompleted(args.CommandContext);
        }
Example #2
0
        public AppConfig(AppSettings appSettings, IConsole console,
                         IDependencyResolver dependencyResolver, IHelpProvider helpProvider,
                         NameTransformation nameTransformation, Action <OnRunCompletedEventArgs> onRunCompleted,
                         TokenizationEvents tokenizationEvents, BuildEvents buildEvents, IServices services,
                         CancellationToken cancellationToken,
                         Dictionary <Type, Func <CommandContext, object> > parameterResolversByType)
        {
            AppSettings              = appSettings;
            Console                  = console;
            DependencyResolver       = dependencyResolver;
            HelpProvider             = helpProvider;
            NameTransformation       = nameTransformation ?? ((attributes, memberName, overrideName, commandNodeType) => overrideName ?? memberName);
            OnRunCompleted           = onRunCompleted;
            TokenizationEvents       = tokenizationEvents;
            BuildEvents              = buildEvents;
            Services                 = services;
            CancellationToken        = cancellationToken;
            ParameterResolversByType = parameterResolversByType;

            ResolverService = services.GetOrAdd(() => new ResolverService());
            ResolverService.BackingResolver = dependencyResolver;
            OnRunCompleted += args => ResolverService.OnRunCompleted(args.CommandContext);
        }