# WithConnectionProperty

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

Adds a connection property annotation to the resource being built.

## Definition

```go
func (ResourceWithConnectionString) WithConnectionProperty(
    name string,
    value any,
) ResourceWithConnectionString
```

## Parameters

- `name` (`string`) -- The name of the connection property to add.
- `value` (`any`) -- The value to assign to the connection property, specified as a string or reference expression.

## Returns

[`ResourceWithConnectionString`](/reference/api/go/aspire.hosting/resourcewithconnectionstring.md) -- The same resource builder instance with the specified connection property annotation applied.

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

## Applies to

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