# ResourceWithConnectionString

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `interface`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

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

## Definition

```go
type ResourceWithConnectionString interface{}
```

## Methods

- [GetConnectionProperty](/reference/api/go/aspire.hosting/resourcewithconnectionstring/getconnectionproperty.md) -- `method` -- Retrieves the value of a specified connection property from the resource's connection properties.
  ```go
  GetConnectionProperty(key string) *ReferenceExpression
  ```
- [OnConnectionStringAvailable](/reference/api/go/aspire.hosting/resourcewithconnectionstring/onconnectionstringavailable.md) -- `method` -- Subscribes to the ConnectionStringAvailable event.
  ```go
  OnConnectionStringAvailable(callback func(arg ConnectionStringAvailableEvent)) ResourceWithConnectionString
  ```
- [WithConnectionProperty](/reference/api/go/aspire.hosting/resourcewithconnectionstring/withconnectionproperty.md) -- `method` -- Adds a connection property annotation to the resource being built.
  ```go
  WithConnectionProperty(name string, value any) ResourceWithConnectionString
  ```

## Applies to

- [`ResourceWithConnectionString`](/reference/api/go/aspire.hosting/resourcewithconnectionstring.md)
