ConnectionBuilderExtensions.Use 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) |
将给定 |
Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>) |
将给定 为了获得更好的性能,首选使用 Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) ,如下所示:
|
Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>)
将给定 middleware
的 添加到连接。
如果不调用下一个函数,请改用 Run(IConnectionBuilder, Func<ConnectionContext,Task>) 。
public static Microsoft.AspNetCore.Connections.IConnectionBuilder Use (this Microsoft.AspNetCore.Connections.IConnectionBuilder connectionBuilder, Func<Microsoft.AspNetCore.Connections.ConnectionContext,Microsoft.AspNetCore.Connections.ConnectionDelegate,System.Threading.Tasks.Task> middleware);
static member Use : Microsoft.AspNetCore.Connections.IConnectionBuilder * Func<Microsoft.AspNetCore.Connections.ConnectionContext, Microsoft.AspNetCore.Connections.ConnectionDelegate, System.Threading.Tasks.Task> -> Microsoft.AspNetCore.Connections.IConnectionBuilder
<Extension()>
Public Function Use (connectionBuilder As IConnectionBuilder, middleware As Func(Of ConnectionContext, ConnectionDelegate, Task)) As IConnectionBuilder
参数
- connectionBuilder
- IConnectionBuilder
- middleware
- Func<ConnectionContext,ConnectionDelegate,Task>
要添加到 的 IConnectionBuilder中间件。
返回
适用于
Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>)
将给定 middleware
的 添加到连接。
如果不调用下一个函数,请改用 Run(IConnectionBuilder, Func<ConnectionContext,Task>) 。
为了获得更好的性能,首选使用 Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) ,如下所示:
builder.Use((context, next) =>
{
return next(context);
});
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Connections::IConnectionBuilder ^ Use(Microsoft::AspNetCore::Connections::IConnectionBuilder ^ connectionBuilder, Func<Microsoft::AspNetCore::Connections::ConnectionContext ^, Func<System::Threading::Tasks::Task ^> ^, System::Threading::Tasks::Task ^> ^ middleware);
public static Microsoft.AspNetCore.Connections.IConnectionBuilder Use (this Microsoft.AspNetCore.Connections.IConnectionBuilder connectionBuilder, Func<Microsoft.AspNetCore.Connections.ConnectionContext,Func<System.Threading.Tasks.Task>,System.Threading.Tasks.Task> middleware);
static member Use : Microsoft.AspNetCore.Connections.IConnectionBuilder * Func<Microsoft.AspNetCore.Connections.ConnectionContext, Func<System.Threading.Tasks.Task>, System.Threading.Tasks.Task> -> Microsoft.AspNetCore.Connections.IConnectionBuilder
<Extension()>
Public Function Use (connectionBuilder As IConnectionBuilder, middleware As Func(Of ConnectionContext, Func(Of Task), Task)) As IConnectionBuilder
参数
- connectionBuilder
- IConnectionBuilder
- middleware
- Func<ConnectionContext,Func<Task>,Task>
要添加到 的 IConnectionBuilder中间件。