共用方式為


ResourceBuilderExtensions.GetEndpoint<T> Method

Definition

Gets an EndpointReference by name from the resource. These endpoints are declared either using WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>) or by launch settings (for project resources). The EndpointReference can be used to resolve the address of the endpoint in WithEnvironment<T>(IResourceBuilder<T>, Action<EnvironmentCallbackContext>).

public static Aspire.Hosting.ApplicationModel.EndpointReference GetEndpoint<T> (this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, string name) where T : Aspire.Hosting.ApplicationModel.IResourceWithEndpoints;
static member GetEndpoint : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)> * string -> Aspire.Hosting.ApplicationModel.EndpointReference (requires 'T :> Aspire.Hosting.ApplicationModel.IResourceWithEndpoints)
<Extension()>
Public Function GetEndpoint(Of T As IResourceWithEndpoints) (builder As IResourceBuilder(Of T), name As String) As EndpointReference

Type Parameters

T

The resource type.

Parameters

builder
IResourceBuilder<T>

The the resource builder.

name
String

The name of the endpoint.

Returns

An EndpointReference that can be used to resolve the address of the endpoint after resource allocation has occurred.

Applies to