Skip to content
DocsTry Aspire
DocsTry

KurrentDBBuilderExtensions Methods

ClassMethods3 members
Provides extension methods for adding KurrentDB resources to the application model.
AddKurrentDB(IDistributedApplicationBuilder, string, int?)Section titled AddKurrentDB(IDistributedApplicationBuilder, string, int?)extensionIResourceBuilder<KurrentDBResource>
Adds a KurrentDB resource to the application model. A container is used for local development. The default image is and the tag is .
public static class KurrentDBBuilderExtensions
{
public static IResourceBuilder<KurrentDBResource> AddKurrentDB(
this IDistributedApplicationBuilder builder,
string name,
int? port = null)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
portint?optionalThe port on which the KurrentDB endpoint will be exposed.
IResourceBuilder<KurrentDBResource>A reference to the ApplicationModel.IResourceBuilder`1.
Add a KurrentDB container to the application model and reference it in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var kurrentdb = builder.AddKurrentDB("kurrentdb");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(kurrentdb);
builder.Build().Run();
WithDataBindMount(IResourceBuilder<KurrentDBResource>, string)Section titled WithDataBindMount(IResourceBuilder<KurrentDBResource>, string)extensionIResourceBuilder<KurrentDBResource>
Adds a bind mount for the data folder to a KurrentDB container resource.
public static class KurrentDBBuilderExtensions
{
public static IResourceBuilder<KurrentDBResource> WithDataBindMount(
this IResourceBuilder<KurrentDBResource> builder,
string source)
{
// ...
}
}
builderIResourceBuilder<KurrentDBResource>The resource builder.
sourcestringThe source directory on the host to mount into the container.
IResourceBuilder<KurrentDBResource>The ApplicationModel.IResourceBuilder`1.
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.
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();
WithDataVolume(IResourceBuilder<KurrentDBResource>, string?)Section titled WithDataVolume(IResourceBuilder<KurrentDBResource>, string?)extensionIResourceBuilder<KurrentDBResource>
Adds a named volume for the data folder to a KurrentDB container resource.
public static class KurrentDBBuilderExtensions
{
public static IResourceBuilder<KurrentDBResource> WithDataVolume(
this IResourceBuilder<KurrentDBResource> builder,
string? name = null)
{
// ...
}
}
builderIResourceBuilder<KurrentDBResource>The resource builder.
namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.
IResourceBuilder<KurrentDBResource>The ApplicationModel.IResourceBuilder`1.
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.
var builder = DistributedApplication.CreateBuilder(args);
var kurrentdb = builder.AddKurrentDB("kurrentdb")
.WithDataVolume();
var api = builder.AddProject<Projects.Api>("api")
.WithReference(kurrentdb);
builder.Build().Run();