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

Source:
ConnectionBuilderExtensions.cs
Source:
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>)

Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
ConnectionBuilderExtensions.cs
Source:
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

适用于