UseWhenExtensions.UseWhen 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
有条件地在请求管道中创建重新加入main管道的分支。
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>
配置要执行的分支操作