Class WebApplicationBuilderExtensions
IApplicationBuilder extension methods.
[SuppressType]
public static class WebApplicationBuilderExtensions
- Inheritance
-
WebApplicationBuilderExtensions
- Inherited Members
Methods
UseIf(WebApplication, bool, Action<WebApplication>)
Executes the specified action if the specified condition
is true
which can be
used to conditionally add to the request execution pipeline.
public static WebApplication UseIf(this WebApplication application, bool condition, Action<WebApplication> action)
Parameters
application
WebApplicationThe application builder.
condition
boolIf set to
true
the action is executed.action
Action<WebApplication>The action used to add to the request execution pipeline.
Returns
- WebApplication
The same application builder.
UseIfElse(WebApplication, bool, Action<WebApplication>, Action<WebApplication>)
Executes the specified ifAction
if the specified condition
is
true
, otherwise executes the elseAction
. This can be used to conditionally add to
the request execution pipeline.
public static WebApplication UseIfElse(this WebApplication application, bool condition, Action<WebApplication> ifAction, Action<WebApplication> elseAction)
Parameters
application
WebApplicationThe application builder.
condition
boolIf set to
true
theifAction
is executed, otherwise theelseAction
is executed.ifAction
Action<WebApplication>The action used to add to the request execution pipeline if the condition is
true
.elseAction
Action<WebApplication>The action used to add to the request execution pipeline if the condition is
false
.
Returns
- WebApplication
The same application builder.