Condividi tramite


DistributedApplicationHostingTestingExtensions.GetConnectionStringAsync Method

Definition

Gets the connection string for the specified resource.

public static System.Threading.Tasks.ValueTask<string?> GetConnectionStringAsync (this Aspire.Hosting.DistributedApplication app, string resourceName, System.Threading.CancellationToken cancellationToken = default);
static member GetConnectionStringAsync : Aspire.Hosting.DistributedApplication * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<string>
<Extension()>
Public Function GetConnectionStringAsync (app As DistributedApplication, resourceName As String, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of String)

Parameters

app
DistributedApplication

The application.

resourceName
String

The resource name.

cancellationToken
CancellationToken

A CancellationToken.

Returns

The connection string for the specified resource.

Exceptions

The resource was not found or does not expose a connection string.

Applies to