# ConnectionStringReference Constructors

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [ConnectionStringReference](/reference/api/csharp/aspire.hosting/connectionstringreference.md)
- Kind: `Constructors`
- Members: `1`

Represents a reference to a connection string.

## ConnectionStringReference(IResourceWithConnectionString, bool)

- Name: `Constructor(IResourceWithConnectionString, bool)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/ConnectionStringReference.cs#L8-L18)

Represents a reference to a connection string.

```csharp
public class ConnectionStringReference
{
    public ConnectionStringReference(
        IResourceWithConnectionString resource,
        bool optional)
    {
        // ...
    }
}
```

## Parameters

- `resource` ([IResourceWithConnectionString](/reference/api/csharp/aspire.hosting/iresourcewithconnectionstring.md))
- `optional` (`bool`)
