UseWhenExtensions.UseWhen(IApplicationBuilder, Func<HttpContext,Boolean>, Action<IApplicationBuilder>) 方法

定义

有条件地在请求管道中创建分支,并将其重新加入到主管道。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseWhen(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ app, Func<Microsoft::AspNetCore::Http::HttpContext ^, bool> ^ predicate, Action<Microsoft::AspNetCore::Builder::IApplicationBuilder ^> ^ configuration);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseWhen (this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Func<Microsoft.AspNetCore.Http.HttpContext,bool> predicate, Action<Microsoft.AspNetCore.Builder.IApplicationBuilder> configuration);
static member UseWhen : Microsoft.AspNetCore.Builder.IApplicationBuilder * Func<Microsoft.AspNetCore.Http.HttpContext, bool> * Action<Microsoft.AspNetCore.Builder.IApplicationBuilder> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseWhen (app As IApplicationBuilder, predicate As Func(Of HttpContext, Boolean), configuration As Action(Of IApplicationBuilder)) As IApplicationBuilder

参数

predicate
Func<HttpContext,Boolean>

通过请求环境进行调用以确定是否应执行分支操作

configuration
Action<IApplicationBuilder>

配置要执行的分支操作

返回

IApplicationBuilder

适用于