共用方式為


ConnectionBuilderExtensions.Use 方法

定義

多載

Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>)

將指定的 middleware 新增至連線。 如果您未呼叫下一個函式,請改用 Run(IConnectionBuilder, Func<ConnectionContext,Task>)

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);
});

Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>)

來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs

將指定的 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

IConnectionBuilder

middleware
Func<ConnectionContext,ConnectionDelegate,Task>

要加入至 的 IConnectionBuilder 中介軟體。

傳回

IConnectionBuilder

適用於

Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>)

來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs
來源:
ConnectionBuilderExtensions.cs

將指定的 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

IConnectionBuilder

middleware
Func<ConnectionContext,Func<Task>,Task>

要加入至 的 IConnectionBuilder 中介軟體。

傳回

IConnectionBuilder

適用於