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 中介軟體。