Skip to content
DocsTry Aspire
DocsTry

IResourceWithConnectionString Methods

InterfaceMethods2 members
Represents a resource that has a connection string associated with it.
GetConnectionPropertiesSection titled GetConnectionPropertiesvirtualIEnumerable<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)virtualValueTask<string?>
Gets the connection string associated with the resource.
public interface IResourceWithConnectionString
{
public virtual ValueTask<string?> GetConnectionStringAsync(
CancellationToken cancellationToken = default(CancellationToken))
{
// ...
}
}
cancellationTokenCancellationTokenoptional 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.