EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>) 方法

定义

使用从配置的 生成的实例将中间件添加到 Microsoft.AspNetCore.Routing.EndpointMiddleware IApplicationBuilder 指定的 EndpointDataSource IEndpointRouteBuilderMicrosoft.AspNetCore.Routing.EndpointMiddleware将执行 Endpoint 与当前请求关联的 。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Builder::IApplicationBuilder ^ UseEndpoints(Microsoft::AspNetCore::Builder::IApplicationBuilder ^ builder, Action<Microsoft::AspNetCore::Routing::IEndpointRouteBuilder ^> ^ configure);
public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseEndpoints (this Microsoft.AspNetCore.Builder.IApplicationBuilder builder, Action<Microsoft.AspNetCore.Routing.IEndpointRouteBuilder> configure);
static member UseEndpoints : Microsoft.AspNetCore.Builder.IApplicationBuilder * Action<Microsoft.AspNetCore.Routing.IEndpointRouteBuilder> -> Microsoft.AspNetCore.Builder.IApplicationBuilder
<Extension()>
Public Function UseEndpoints (builder As IApplicationBuilder, configure As Action(Of IEndpointRouteBuilder)) As IApplicationBuilder

参数

builder
IApplicationBuilder

IApplicationBuilder 添加中间件的 。

configure
Action<IEndpointRouteBuilder>

用于配置所提供的 IEndpointRouteBuilderAction<T>

返回

IApplicationBuilder

完成操作后对此实例的引用。

注解

对 的 UseEndpoints(IApplicationBuilder, Action<IEndpointRouteBuilder>) 调用前面必须是对同 UseRouting(IApplicationBuilder) 一实例的 IApplicationBuilder 调用。

定义中间件管道中做出路由决策的点,并且 Microsoft.AspNetCore.Routing.EndpointRoutingMiddlewareEndpoint 相关联 HttpContextMicrosoft.AspNetCore.Routing.EndpointMiddleware定义中间件管道中执行当前 的 Endpoint 点。 和 之间的 Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware 中间 Microsoft.AspNetCore.Routing.EndpointMiddleware 件可能会观察或更改与 Endpoint 关联的 HttpContext

适用于