# KurrentDBBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.KurrentDB](/reference/api/csharp/communitytoolkit.aspire.hosting.kurrentdb.md)
- Type: [KurrentDBBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.kurrentdb/kurrentdbbuilderextensions.md)
- Kind: `Methods`
- Members: `3`

Provides extension methods for adding KurrentDB resources to the application model.

## AddKurrentDB(IDistributedApplicationBuilder, string, int?)

- Name: `AddKurrentDB(IDistributedApplicationBuilder, string, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<KurrentDBResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.KurrentDB/KurrentDBBuilderExtensions.cs#L46-L76)

Adds a KurrentDB resource to the application model. A container is used for local development. The default image is and the tag is .

```csharp
public static class KurrentDBBuilderExtensions
{
    public static IResourceBuilder<KurrentDBResource> AddKurrentDB(
        this IDistributedApplicationBuilder builder,
        string name,
        int? port = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The `Hosting.IDistributedApplicationBuilder`.
- `name` (`string`)
  The name of the resource. This name will be used as the connection string name when referenced in a dependency.
- `port` (`int?`) `optional`
  The port on which the KurrentDB endpoint will be exposed.

## Returns

`IResourceBuilder<KurrentDBResource>` -- A reference to the `ApplicationModel.IResourceBuilder`1`.

## Remarks

Add a KurrentDB container to the application model and reference it in a .NET project.

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var kurrentdb = builder.AddKurrentDB("kurrentdb");
var api = builder.AddProject<Projects.Api>("api")
  .WithReference(kurrentdb);

builder.Build().Run();
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithDataBindMount(IResourceBuilder<KurrentDBResource>, string)

- Name: `WithDataBindMount(IResourceBuilder<KurrentDBResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<KurrentDBResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.KurrentDB/KurrentDBBuilderExtensions.cs#L134-L137)

Adds a bind mount for the data folder to a KurrentDB container resource.

```csharp
public static class KurrentDBBuilderExtensions
{
    public static IResourceBuilder<KurrentDBResource> WithDataBindMount(
        this IResourceBuilder<KurrentDBResource> builder,
        string source)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<KurrentDBResource>`)
  The resource builder.
- `source` (`string`)
  The source directory on the host to mount into the container.

## Returns

`IResourceBuilder<KurrentDBResource>` -- The `ApplicationModel.IResourceBuilder`1`.

## Remarks

Add a KurrentDB container to the application model and reference it in a .NET project. Additionally, in this example a bind mount is added to the container to allow data to be persisted across container restarts.

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var kurrentdb = builder.AddKurrentDB("kurrentdb")
  .WithDataBindMount("./data/kurrentdb/data");
var api = builder.AddProject<Projects.Api>("api")
  .WithReference(kurrentdb);

builder.Build().Run();
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

## WithDataVolume(IResourceBuilder<KurrentDBResource>, string?)

- Name: `WithDataVolume(IResourceBuilder<KurrentDBResource>, string?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<KurrentDBResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.KurrentDB/KurrentDBBuilderExtensions.cs#L104-L106)

Adds a named volume for the data folder to a KurrentDB container resource.

```csharp
public static class KurrentDBBuilderExtensions
{
    public static IResourceBuilder<KurrentDBResource> WithDataVolume(
        this IResourceBuilder<KurrentDBResource> builder,
        string? name = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<KurrentDBResource>`)
  The resource builder.
- `name` (`string?`) `optional`
  The name of the volume. Defaults to an auto-generated name based on the application and resource names.

## Returns

`IResourceBuilder<KurrentDBResource>` -- The `ApplicationModel.IResourceBuilder`1`.

## Remarks

Add a KurrentDB container to the application model and reference it in a .NET project. Additionally, in this example a data volume is added to the container to allow data to be persisted across container restarts.

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var kurrentdb = builder.AddKurrentDB("kurrentdb")
  .WithDataVolume();
var api = builder.AddProject<Projects.Api>("api")
  .WithReference(kurrentdb);

builder.Build().Run();
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
