Table of Contents

Constructor UseCaseAsyncCommand

Namespace
Ploch.CommandLine.UseCases
Assembly
Ploch.CommandLine.UseCases.dll

UseCaseAsyncCommand(IOutput, TUseCase, CommandArgumentsRootProcessor, ICommandSettingsValidator<TCommandSettings>, IExceptionHandler)

Base class for asynchronous commands that delegate their work to a use case and render its result.

protected UseCaseAsyncCommand(IOutput output, TUseCase useCase, CommandArgumentsRootProcessor settingsProcessor, ICommandSettingsValidator<TCommandSettings> validator, IExceptionHandler exceptionHandler)

Parameters

output IOutput

The output writer used to render progress and results.

useCase TUseCase

The use case executed by this command.

settingsProcessor CommandArgumentsRootProcessor

The processor applied to the command settings before execution.

validator ICommandSettingsValidator<TCommandSettings>

The validator used to validate the command settings.

exceptionHandler IExceptionHandler

The handler used to process exceptions raised during execution.

Remarks

The four type parameters are deliberate. TCommandSettings is required by the AsyncAppCommand<TSettings> base class. TUseCase keeps the concrete use case type, so a derived command can reach members beyond IResultUseCase<TRequest, TResponse>. C# cannot infer TUseCaseRequest and TUseCaseResponse from TUseCase, so they must be stated to constrain it and to type the request and the rendered result.