ConnectionBuilderExtensions.Use Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) |
Add the given |
Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>) |
Add the given Prefer using Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) for better performance as shown below:
|
Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>)
Add the given middleware
to the connection.
If you aren't calling the next function, use Run(IConnectionBuilder, Func<ConnectionContext,Task>) instead.
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
Parameters
- connectionBuilder
- IConnectionBuilder
The IConnectionBuilder.
- middleware
- Func<ConnectionContext,ConnectionDelegate,Task>
The middleware to add to the IConnectionBuilder.
Returns
The IConnectionBuilder.
Applies to
Use(IConnectionBuilder, Func<ConnectionContext,Func<Task>,Task>)
Add the given middleware
to the connection.
If you aren't calling the next function, use Run(IConnectionBuilder, Func<ConnectionContext,Task>) instead.
Prefer using Use(IConnectionBuilder, Func<ConnectionContext,ConnectionDelegate,Task>) for better performance as shown below:
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
Parameters
- connectionBuilder
- IConnectionBuilder
The IConnectionBuilder.
- middleware
- Func<ConnectionContext,Func<Task>,Task>
The middleware to add to the IConnectionBuilder.
Returns
The IConnectionBuilder.