RavenDBBuilderExtensions Methods
ClassMethods8 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)extensionIResourceBuilder<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) { // ... }}Parameters
builderIResourceBuilder<RavenDBServerResource>The resource builder for the RavenDB server.namestringThe name of the database resource.databaseNamestring?optionalThe name of the database to create/add. Defaults to the same name as the resource if not provided.ensureCreatedbooloptionalIndicates whether the database should be created on startup if it does not already exist.Returns
IResourceBuilder<RavenDBDatabaseResource>A resource builder for the newly added RavenDB database resource.Exceptions
DistributedApplicationExceptionThrown when the connection string cannot be retrieved during configuration.InvalidOperationExceptionThrown when the connection string is unavailable.AddRavenDB(IDistributedApplicationBuilder, string)Section titled AddRavenDB(IDistributedApplicationBuilder, string)extensionIResourceBuilder<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) { // ... }}Parameters
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to which the resource is added.namestringThe name of the RavenDB server resource.Returns
IResourceBuilder<RavenDBServerResource>A resource builder for the newly added RavenDB server resource.Exceptions
ArgumentNullExceptionThrown if builder is null.Remarks
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)extensionIResourceBuilder<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) { // ... }}Parameters
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuildernamestringThe name of the RavenDB server resource.serverSettingsRavenDBServerSettingsAn 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.Returns
IResourceBuilder<RavenDBServerResource>A resource builder for the newly added RavenDB server resource.Exceptions
DistributedApplicationExceptionThrown when the connection string cannot be retrieved during configuration.InvalidOperationExceptionThrown when the connection string is unavailable.Remarks
This overload is not available in polyglot app hosts.
AddRavenDB(IDistributedApplicationBuilder, string, bool, Dictionary<string, object>, int?)Section titled AddRavenDB(IDistributedApplicationBuilder, string, bool, Dictionary<string, object>, int?)extensionIResourceBuilder<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) { // ... }}Parameters
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuildernamestringThe name of the RavenDB server resource.securedboolIndicates whether the server connection should be secured (HTTPS). Defaults to false.environmentVariablesDictionary<string, object>The environment variables to configure the RavenDB server.portint?optionalOptional port for the server. If not provided, defaults to the container's internal port (8080).Returns
IResourceBuilder<RavenDBServerResource>A resource builder for the newly added RavenDB server resource.Exceptions
DistributedApplicationExceptionThrown when the connection string cannot be retrieved during configuration.InvalidOperationExceptionThrown when the connection string is unavailable.Remarks
This overload is not available in polyglot app hosts.
WithDataBindMount(IResourceBuilder<RavenDBServerResource>, string, bool)Section titled WithDataBindMount(IResourceBuilder<RavenDBServerResource>, string, bool)extensionIResourceBuilder<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) { // ... }}Parameters
builderIResourceBuilder<RavenDBServerResource>The resource builder for the RavenDB server.sourcestringThe source directory on the host to mount into the container.isReadOnlybooloptionalIndicates whether the bind mount should be read-only. Defaults to false.Returns
IResourceBuilder<RavenDBServerResource>The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.WithDataVolume(IResourceBuilder<RavenDBServerResource>, string?, bool)Section titled WithDataVolume(IResourceBuilder<RavenDBServerResource>, string?, bool)extensionIResourceBuilder<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) { // ... }}Parameters
builderIResourceBuilder<RavenDBServerResource>The resource builder for the RavenDB server.namestring?optionalOptional name for the volume. Defaults to a generated name if not provided.isReadOnlybooloptionalIndicates whether the volume should be read-only. Defaults to false.Returns
IResourceBuilder<RavenDBServerResource>The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.WithLogBindMount(IResourceBuilder<RavenDBServerResource>, string, bool)Section titled WithLogBindMount(IResourceBuilder<RavenDBServerResource>, string, bool)extensionIResourceBuilder<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) { // ... }}Parameters
builderIResourceBuilder<RavenDBServerResource>The resource builder for the RavenDB server.sourcestringThe source directory on the host to mount into the container.isReadOnlybooloptionalIndicates whether the bind mount should be read-only. Defaults to false.Returns
IResourceBuilder<RavenDBServerResource>The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.WithLogVolume(IResourceBuilder<RavenDBServerResource>, string?, bool)Section titled WithLogVolume(IResourceBuilder<RavenDBServerResource>, string?, bool)extensionIResourceBuilder<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) { // ... }}Parameters
builderIResourceBuilder<RavenDBServerResource>The resource builder for the RavenDB server.namestring?optional Optional name for the volume. Defaults to a generated name if not provided. isReadOnlybooloptionalIndicates whether the volume should be read-only. Defaults to false.Returns
IResourceBuilder<RavenDBServerResource>The ApplicationModel.IResourceBuilder`1 for the RavenDB server resource.