Share via


MiddlewareWorkerApplicationBuilderExtensions.UseWhen Method

Definition

Overloads

UseWhen(IFunctionsWorkerApplicationBuilder, Func<FunctionContext,Boolean>, Func<FunctionContext,Func<Task>,Task>)

Configures the IFunctionsWorkerApplicationBuilder to use the provided inline middleware delegate when the provided predicate expression returns true.

UseWhen<T>(IFunctionsWorkerApplicationBuilder, Func<FunctionContext,Boolean>)

Configures the IFunctionsWorkerApplicationBuilder to use the provided middleware type, when the provided predicate expression returns true.

UseWhen(IFunctionsWorkerApplicationBuilder, Func<FunctionContext,Boolean>, Func<FunctionContext,Func<Task>,Task>)

Source:
WorkerMiddlewareWorkerApplicationBuilderExtensions.cs

Configures the IFunctionsWorkerApplicationBuilder to use the provided inline middleware delegate when the provided predicate expression returns true.

public static Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder UseWhen (this Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder builder, Func<Microsoft.Azure.Functions.Worker.FunctionContext,bool> predicate, Func<Microsoft.Azure.Functions.Worker.FunctionContext,Func<System.Threading.Tasks.Task>,System.Threading.Tasks.Task> middleware);
static member UseWhen : Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder * Func<Microsoft.Azure.Functions.Worker.FunctionContext, bool> * Func<Microsoft.Azure.Functions.Worker.FunctionContext, Func<System.Threading.Tasks.Task>, System.Threading.Tasks.Task> -> Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder
<Extension()>
Public Function UseWhen (builder As IFunctionsWorkerApplicationBuilder, predicate As Func(Of FunctionContext, Boolean), middleware As Func(Of FunctionContext, Func(Of Task), Task)) As IFunctionsWorkerApplicationBuilder

Parameters

predicate
Func<FunctionContext,Boolean>

Predicate which gets invoked to determine if middleware should be executed during a function invocation.

middleware
Func<FunctionContext,Func<Task>,Task>

The middleware to add to the invocation pipeline.

Returns

The same IFunctionsWorkerApplicationBuilder for chaining.

Applies to

UseWhen<T>(IFunctionsWorkerApplicationBuilder, Func<FunctionContext,Boolean>)

Source:
WorkerMiddlewareWorkerApplicationBuilderExtensions.cs

Configures the IFunctionsWorkerApplicationBuilder to use the provided middleware type, when the provided predicate expression returns true.

public static Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder UseWhen<T> (this Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder builder, Func<Microsoft.Azure.Functions.Worker.FunctionContext,bool> predicate) where T : class, Microsoft.Azure.Functions.Worker.Middleware.IFunctionsWorkerMiddleware;
static member UseWhen : Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder * Func<Microsoft.Azure.Functions.Worker.FunctionContext, bool> -> Microsoft.Azure.Functions.Worker.IFunctionsWorkerApplicationBuilder (requires 'T : null and 'T :> Microsoft.Azure.Functions.Worker.Middleware.IFunctionsWorkerMiddleware)
<Extension()>
Public Function UseWhen(Of T As {Class, IFunctionsWorkerMiddleware}) (builder As IFunctionsWorkerApplicationBuilder, predicate As Func(Of FunctionContext, Boolean)) As IFunctionsWorkerApplicationBuilder

Type Parameters

T

Parameters

predicate
Func<FunctionContext,Boolean>

Predicate which gets invoked to determine if middleware should be executed during a function invocation.

Returns

The same instance of the IFunctionsWorkerApplicationBuilder for chaining.

Applies to