-
Notifications
You must be signed in to change notification settings - Fork 13
Middleware pipeline
Adam Bajguz edited this page Aug 23, 2020
·
25 revisions
Typin uses middleware pipeline to execute commands. By default it consists of CommandExecution
. CommandExecution
is always executed at the end of the pipeline, just before ICliMiddlewareExtensions.PipelineTermination
action.
public sealed class CommandExecution : IMiddleware
{
public CommandExecution()
{
}
public async Task HandleAsync(ICliContext context, CommandPipelineHandlerDelegate next, CancellationToken cancellationToken)
{
context.Console.Output.WriteLine("-- Before command execution --");
await next(context, cancellationToken);
context.Console.Output.WriteLine("-- After command execution-- ");
}
}
Getting started
Advanced features
- Reporting errors
- Exception handling
- Metadata and startup message
- Graceful cancellation
- Dependency injection
- Middleware pipeline
- Environment variables
Utilities
Tests
Misc