Skip to content
Docs Try Aspire

RavenDBBuilderExtensions Methods

Class Methods 8 members
Provides extension methods for adding RavenDB resources to an Hosting.IDistributedApplicationBuilder.
AddDatabase(IResourceBuilder<RavenDBServerResource>, string, string?, bool) Section titled AddDatabase(IResourceBuilder<RavenDBServerResource>, string, string?, bool) extension IResourceBuilder<RavenDBDatabaseResource>
Adds a database resource to an existing RavenDB server resource.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBDatabaseResource> AddDatabase(
this IResourceBuilder<RavenDBServerResource> builder,
string name,
string? databaseName = null,
bool ensureCreated = false)
{
// ...
}
}
builder IResourceBuilder<RavenDBServerResource> The resource builder for the RavenDB server.
name string The name of the database resource.
databaseName string? optional The name of the database to create/add. Defaults to the same name as the resource if not provided.
ensureCreated bool optional Indicates whether the database should be created on startup if it does not already exist.
IResourceBuilder<RavenDBDatabaseResource> A resource builder for the newly added RavenDB database resource.
DistributedApplicationException Thrown when the connection string cannot be retrieved during configuration.
InvalidOperationException Thrown when the connection string is unavailable.
AddRavenDB(IDistributedApplicationBuilder, string) Section titled AddRavenDB(IDistributedApplicationBuilder, string) extension IResourceBuilder<RavenDBServerResource>
Adds a RavenDB server resource to the application model. A container is used for local development. This overload simplifies the configuration by creating an unsecured RavenDB server resource with default settings.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> AddRavenDB(
this IDistributedApplicationBuilder builder,
string name)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to which the resource is added.
name string The name of the RavenDB server resource.
IResourceBuilder<RavenDBServerResource> A resource builder for the newly added RavenDB server resource.
ArgumentNullException Thrown if builder is null.

Note: When using this method, a valid RavenDB license must be provided as an environment variable before calling the IDistributedApplicationBuilder.Build and DistributedApplication.Run methods. You can set the license by calling:

builder.WithEnvironment("RAVEN_License", "{your license}");

AddRavenDB(IDistributedApplicationBuilder, string, RavenDBServerSettings) Section titled AddRavenDB(IDistributedApplicationBuilder, string, RavenDBServerSettings) extension IResourceBuilder<RavenDBServerResource>
Adds a RavenDB server resource to the application model. A container is used for local development. This version of the package defaults to the tag of the container image. This overload simplifies configuration by accepting a RavenDBServerSettings object to specify server settings.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> AddRavenDB(
this IDistributedApplicationBuilder builder,
string name,
RavenDBServerSettings serverSettings)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder
name string The name of the RavenDB server resource.
serverSettings RavenDBServerSettings An object of type RavenDBServerSettings containing configuration details for the RavenDB server, such as whether the server should use HTTPS, RavenDB license and other relevant settings.
IResourceBuilder<RavenDBServerResource> A resource builder for the newly added RavenDB server resource.
DistributedApplicationException Thrown when the connection string cannot be retrieved during configuration.
InvalidOperationException Thrown when the connection string is unavailable.
AddRavenDB(IDistributedApplicationBuilder, string, bool, Dictionary<string, object>, int?) Section titled AddRavenDB(IDistributedApplicationBuilder, string, bool, Dictionary<string, object>, int?) extension IResourceBuilder<RavenDBServerResource>
Adds a RavenDB server resource to the application model. A container is used for local development. This version of the package defaults to the tag of the container image.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> AddRavenDB(
this IDistributedApplicationBuilder builder,
string name,
bool secured,
Dictionary<string, object> environmentVariables,
int? port = null)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder
name string The name of the RavenDB server resource.
secured bool Indicates whether the server connection should be secured (HTTPS). Defaults to false.
environmentVariables Dictionary<string, object> The environment variables to configure the RavenDB server.
port int? optional Optional port for the server. If not provided, defaults to the container's internal port (8080).
IResourceBuilder<RavenDBServerResource> A resource builder for the newly added RavenDB server resource.
DistributedApplicationException Thrown when the connection string cannot be retrieved during configuration.
InvalidOperationException Thrown when the connection string is unavailable.
WithDataBindMount(IResourceBuilder<RavenDBServerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<RavenDBServerResource>, string, bool) extension IResourceBuilder<RavenDBServerResource>
Adds a bind mount for the data folder to a RavenDB container resource.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> WithDataBindMount(
this IResourceBuilder<RavenDBServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RavenDBServerResource> The resource builder for the RavenDB server.
source string The source directory on the host to mount into the container.
isReadOnly bool optional Indicates whether the bind mount should be read-only. Defaults to false.
IResourceBuilder<RavenDBServerResource> The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.
WithDataVolume(IResourceBuilder<RavenDBServerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<RavenDBServerResource>, string?, bool) extension IResourceBuilder<RavenDBServerResource>
Adds a named volume for the data folder to a RavenDB container resource.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> WithDataVolume(
this IResourceBuilder<RavenDBServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RavenDBServerResource> The resource builder for the RavenDB server.
name string? optional Optional name for the volume. Defaults to a generated name if not provided.
isReadOnly bool optional Indicates whether the volume should be read-only. Defaults to false.
IResourceBuilder<RavenDBServerResource> The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.
WithLogBindMount(IResourceBuilder<RavenDBServerResource>, string, bool) Section titled WithLogBindMount(IResourceBuilder<RavenDBServerResource>, string, bool) extension IResourceBuilder<RavenDBServerResource>
Adds a bind mount for the logs folder to a RavenDB container resource.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> WithLogBindMount(
this IResourceBuilder<RavenDBServerResource> builder,
string source,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RavenDBServerResource> The resource builder for the RavenDB server.
source string The source directory on the host to mount into the container.
isReadOnly bool optional Indicates whether the bind mount should be read-only. Defaults to false.
IResourceBuilder<RavenDBServerResource> The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.
WithLogVolume(IResourceBuilder<RavenDBServerResource>, string?, bool) Section titled WithLogVolume(IResourceBuilder<RavenDBServerResource>, string?, bool) extension IResourceBuilder<RavenDBServerResource>
Adds a named volume for the logs folder to a RavenDB container resource.
public static class RavenDBBuilderExtensions
{
public static IResourceBuilder<RavenDBServerResource> WithLogVolume(
this IResourceBuilder<RavenDBServerResource> builder,
string? name = null,
bool isReadOnly = false)
{
// ...
}
}
builder IResourceBuilder<RavenDBServerResource> The resource builder for the RavenDB server.
name string? optional Optional name for the volume. Defaults to a generated name if not provided.
isReadOnly bool optional Indicates whether the volume should be read-only. Defaults to false.
IResourceBuilder<RavenDBServerResource> The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.