MapWhenExtensions Class

Extension methods for the Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.

Namespace
Microsoft.AspNetCore.Builder
Assemblies
  • Microsoft.AspNetCore.Http.Abstractions

Syntax

public class MapWhenExtensions
class Microsoft.AspNetCore.Builder.MapWhenExtensions

Methods

MapWhen(Microsoft.AspNetCore.Builder.IApplicationBuilder, System.Func<Microsoft.AspNetCore.Http.HttpContext, System.Boolean>, System.Action<Microsoft.AspNetCore.Builder.IApplicationBuilder>)

Branches the request pipeline based on the result of the given predicate.

Arguments:
  • predicate (System.Func<Microsoft.AspNetCore.Http.HttpContext>) – Invoked with the request environment to determine if the branch should be taken
  • configuration (System.Action<Microsoft.AspNetCore.Builder.IApplicationBuilder>) – Configures a branch to take
Return type:

Microsoft.AspNetCore.Builder.IApplicationBuilder

public static IApplicationBuilder MapWhen(this IApplicationBuilder app, Func<HttpContext, bool> predicate, Action<IApplicationBuilder> configuration)