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
applicationWebApplicationThe application builder.
conditionboolIf set to
truethe action is executed.actionAction<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
applicationWebApplicationThe application builder.
conditionboolIf set to
truetheifActionis executed, otherwise theelseActionis executed.ifActionAction<WebApplication>The action used to add to the request execution pipeline if the condition is
true.elseActionAction<WebApplication>The action used to add to the request execution pipeline if the condition is
false.
Returns
- WebApplication
The same application builder.