# CosmosDatabaseBuilder

- Kind: `class`
- Package: [Aspire.Microsoft.Azure.Cosmos](/reference/api/csharp/aspire.microsoft.azure.cosmos.md)
- Version: `13.4.0`
- Namespace: `Aspire.Microsoft.Azure.Cosmos`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Components/Aspire.Microsoft.Azure.Cosmos/CosmosDatabaseBuilder.cs)

Represents a builder that can be used to register multiple container instances against the same Cosmos database connection.

## Definition

```csharp
namespace Aspire.Microsoft.Azure.Cosmos;

public sealed class CosmosDatabaseBuilder
{
    // ...
}
```

## Constructors

- [CosmosDatabaseBuilder(IHostApplicationBuilder, string, MicrosoftAzureCosmosSettings, CosmosClientOptions)](/reference/api/csharp/aspire.microsoft.azure.cosmos/cosmosdatabasebuilder/constructors.md#constructor-ihostapplicationbuilder-string-microsoftazurecosmossettings-cosmosclientoptions) -- Represents a builder that can be used to register multiple container instances against the same Cosmos database connection.

## Methods

- [AddKeyedContainer(string)](/reference/api/csharp/aspire.microsoft.azure.cosmos/cosmosdatabasebuilder/methods.md#addkeyedcontainer-string) : [CosmosDatabaseBuilder](/reference/api/csharp/aspire.microsoft.azure.cosmos/cosmosdatabasebuilder.md) -- Register a `Cosmos.Container` against the database managed with [CosmosDatabaseBuilder](/reference/api/csharp/aspire.microsoft.azure.cosmos/cosmosdatabasebuilder.md) as a keyed singleton.
