CommandLineBuilderExtensions.AddMiddleware Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
AddMiddleware(CommandLineBuilder, Action<InvocationContext>, MiddlewareOrder) |
Adds a middleware delegate to the invocation pipeline called before a command handler is invoked. |
AddMiddleware(CommandLineBuilder, InvocationMiddleware, MiddlewareOrder) |
Adds a middleware delegate to the invocation pipeline called before a command handler is invoked. |
AddMiddleware(CommandLineBuilder, Action<InvocationContext>, MiddlewareOrder)
Adds a middleware delegate to the invocation pipeline called before a command handler is invoked.
public static System.CommandLine.Builder.CommandLineBuilder AddMiddleware (this System.CommandLine.Builder.CommandLineBuilder builder, Action<System.CommandLine.Invocation.InvocationContext> onInvoke, System.CommandLine.Invocation.MiddlewareOrder order = System.CommandLine.Invocation.MiddlewareOrder.Default);
static member AddMiddleware : System.CommandLine.Builder.CommandLineBuilder * Action<System.CommandLine.Invocation.InvocationContext> * System.CommandLine.Invocation.MiddlewareOrder -> System.CommandLine.Builder.CommandLineBuilder
<Extension()>
Public Function AddMiddleware (builder As CommandLineBuilder, onInvoke As Action(Of InvocationContext), Optional order As MiddlewareOrder = System.CommandLine.Invocation.MiddlewareOrder.Default) As CommandLineBuilder
Parameters
- builder
- CommandLineBuilder
A command line builder.
- onInvoke
- Action<InvocationContext>
A delegate that will be invoked before a call to a command handler.
- order
- MiddlewareOrder
A value indicating the order in which the added delegate will be invoked relative to others in the pipeline.
Returns
The same instance of CommandLineBuilder.
Applies to
AddMiddleware(CommandLineBuilder, InvocationMiddleware, MiddlewareOrder)
Adds a middleware delegate to the invocation pipeline called before a command handler is invoked.
public static System.CommandLine.Builder.CommandLineBuilder AddMiddleware (this System.CommandLine.Builder.CommandLineBuilder builder, System.CommandLine.Invocation.InvocationMiddleware middleware, System.CommandLine.Invocation.MiddlewareOrder order = System.CommandLine.Invocation.MiddlewareOrder.Default);
static member AddMiddleware : System.CommandLine.Builder.CommandLineBuilder * System.CommandLine.Invocation.InvocationMiddleware * System.CommandLine.Invocation.MiddlewareOrder -> System.CommandLine.Builder.CommandLineBuilder
<Extension()>
Public Function AddMiddleware (builder As CommandLineBuilder, middleware As InvocationMiddleware, Optional order As MiddlewareOrder = System.CommandLine.Invocation.MiddlewareOrder.Default) As CommandLineBuilder
Parameters
- builder
- CommandLineBuilder
A command line builder.
- middleware
- InvocationMiddleware
A delegate that will be invoked before a call to a command handler.
- order
- MiddlewareOrder
A value indicating the order in which the added delegate will be invoked relative to others in the pipeline.
Returns
The same instance of CommandLineBuilder.