Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

ResourceWithConnectionString

Interface
📦 Aspire.Hosting v17.0.0

Represents a resource that has a connection string associated with it.

type ResourceWithConnectionString interface{}

Methods

Retrieves the value of a specified connection property from the resource's connection properties.
GetConnectionProperty(key string) *ReferenceExpression
keystringThe key of the connection property to retrieve. Cannot be null.
*ReferenceExpression

The value associated with the specified connection property key.

Returns a handle; failures surface later via Err().

Subscribes to the ConnectionStringAvailable event.
OnConnectionStringAvailable(callback func(arg ConnectionStringAvailableEvent)) ResourceWithConnectionString
callbackfunc(arg ConnectionStringAvailableEvent)callbackThe callback to invoke when the event fires.
ResourceWithConnectionString

The resource builder.

Returns a handle; failures surface later via Err().

Adds a connection property annotation to the resource being built.
WithConnectionProperty(
name string,
value any,
) ResourceWithConnectionString
namestringThe name of the connection property to add.
valueanyThe value to assign to the connection property, specified as a string or reference expression.
ResourceWithConnectionString

The same resource builder instance with the specified connection property annotation applied.

Returns a handle; failures surface later via Err().

Applies to

This interface applies to the following types: