اقرأ باللغة الإنجليزية

مشاركة عبر


ConnectionBuilder Class

Definition

A default implementation for IConnectionBuilder.

C#
public class ConnectionBuilder : Microsoft.AspNetCore.Connections.IConnectionBuilder
Inheritance
ConnectionBuilder
Implements

Constructors

Properties

ApplicationServices

Gets the IServiceProvider that provides access to the application's service container.

Methods

Build()

Builds the delegate used by this application to process connections.

Use(Func<ConnectionDelegate,ConnectionDelegate>)

Adds a middleware delegate to the application's connection pipeline.

Extension Methods

Run(IConnectionBuilder, Func<ConnectionContext,Task>)

Add the given middleware to the connection.

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.

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

UseConnectionHandler<TConnectionHandler>(IConnectionBuilder)

Use the given TConnectionHandlerConnectionHandler.

UseHub<THub>(IConnectionBuilder)

Configure the connection to host the specified Hub type.

Applies to

منتج الإصدارات
ASP.NET Core 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0