Skip to content
Docs Try Aspire

IResourceWithConnectionString Methods

Interface Methods 2 members
Represents a resource that has a connection string associated with it.
GetConnectionProperties Section titled GetConnectionProperties virtual IEnumerable<KeyValuePair<string, ReferenceExpression>>
Retrieves a collection of connection property name and value pairs associated with the current context.
public interface IResourceWithConnectionString
{
public virtual IEnumerable<KeyValuePair<string, ReferenceExpression>> GetConnectionProperties()
{
// ...
}
}
IEnumerable<KeyValuePair<string, ReferenceExpression>> An enumerable collection of key/value pairs, where each key is the name of a connection property and each value is its corresponding ReferenceExpression. The collection is empty if there are no connection properties.
GetConnectionStringAsync(CancellationToken) Section titled GetConnectionStringAsync(CancellationToken) virtual ValueTask<string?>
Gets the connection string associated with the resource.
public interface IResourceWithConnectionString
{
public virtual ValueTask<string?> GetConnectionStringAsync(
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
cancellationToken CancellationToken optional A Threading.CancellationToken to observe while waiting for the task to complete.
ValueTask<string?> The connection string associated with the resource, when one is available.