RavenDBClientExtension Methods
ClassMethods4 members
Extension methods for connecting RavenDB database.
AddKeyedRavenDBClient(IHostApplicationBuilder, object, string, Action<RavenDBClientSettings>) Section titled AddKeyedRavenDBClient(IHostApplicationBuilder, object, string, Action<RavenDBClientSettings>)extension Registers
Documents.IDocumentStore and the associated Session.IDocumentSession and Session.IAsyncDocumentSession instances for connecting to an existing or new RavenDB database with RavenDB.Client, identified by a unique service key. public static class RavenDBClientExtension{ public static void AddKeyedRavenDBClient( this IHostApplicationBuilder builder, object serviceKey, string connectionName, Action<RavenDBClientSettings>? configureSettings = null) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder used to add services.serviceKey objectA unique key that identifies this instance of the RavenDB client service.connectionName stringThe name used to retrieve the connection string from the "ConnectionStrings" configuration section.configureSettings Action<RavenDBClientSettings> optionalAn optional delegate that can be used for customizing options. It is invoked after the settings are read from the configuration.Remarks
Notes:
- Reads the configuration from "Aspire:RavenDB:Client" section.
- The
Documents.is registered as a singleton, meaning a single instance is shared throughout the application's lifetime, whileI Document Store Session.andI Document Session Session.are registered per request to ensure short-lived session instances for each use.I Async Document Session
AddKeyedRavenDBClient(IHostApplicationBuilder, object, RavenDBClientSettings) Section titled AddKeyedRavenDBClient(IHostApplicationBuilder, object, RavenDBClientSettings)extension Registers
Documents.IDocumentStore and the associated Session.IDocumentSession and Session.IAsyncDocumentSession instances for connecting to an existing or new RavenDB database with RavenDB.Client, identified by a unique service key. public static class RavenDBClientExtension{ public static void AddKeyedRavenDBClient( this IHostApplicationBuilder builder, object serviceKey, RavenDBClientSettings settings) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder used to add services.serviceKey objectA unique key that identifies this instance of the RavenDB client service.settingsRavenDocuments.IDocumentStore .Remarks
Notes:
- If
Ravenis not specified andDB Client Settings. Database Name Ravenis set to 'false',DB Client Settings. Create Database Session.andI Document Session Session.will not be registered.I Async Document Session - The
Documents.is registered as a singleton, meaning a single instance is shared throughout the application's lifetime, whileI Document Store Session.andI Document Session Session.are registered per request to ensure short-lived session instances for each use.I Async Document Session
AddRavenDBClient(IHostApplicationBuilder, string, Action<RavenDBClientSettings>) Section titled AddRavenDBClient(IHostApplicationBuilder, string, Action<RavenDBClientSettings>)extension Registers
Documents.IDocumentStore and the associated Session.IDocumentSession and Session.IAsyncDocumentSession instances for connecting to an existing or new RavenDB database with RavenDB.Client. public static class RavenDBClientExtension{ public static void AddRavenDBClient( this IHostApplicationBuilder builder, string connectionName, Action<RavenDBClientSettings>? configureSettings = null) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder used to add services.connectionName stringThe name used to retrieve the connection string from the "ConnectionStrings" configuration section.configureSettings Action<RavenDBClientSettings> optionalAn optional delegate that can be used for customizing options. It is invoked after the settings are read from the configuration.Remarks
Notes:
- Reads the configuration from "Aspire:RavenDB:Client" section.
- The
Documents.is registered as a singleton, meaning a single instance is shared throughout the application's lifetime, whileI Document Store Session.andI Document Session Session.are registered per request to ensure short-lived session instances for each use.I Async Document Session
AddRavenDBClient(IHostApplicationBuilder, RavenDBClientSettings) Section titled AddRavenDBClient(IHostApplicationBuilder, RavenDBClientSettings)extension Registers
Documents.IDocumentStore and the associated Session.IDocumentSession and Session.IAsyncDocumentSession instances for connecting to an existing or new RavenDB database with RavenDB.Client. public static class RavenDBClientExtension{ public static void AddRavenDBClient( this IHostApplicationBuilder builder, RavenDBClientSettings settings) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder used to add services.settingsRavenDocuments.IDocumentStore .Remarks
Notes:
- If
Ravenis not specified andDB Client Settings. Database Name Ravenis set to 'false',DB Client Settings. Create Database Session.andI Document Session Session.will not be registered.I Async Document Session - The
Documents.is registered as a singleton, meaning a single instance is shared throughout the application's lifetime, whileI Document Store Session.andI Document Session Session.are registered per request to ensure short-lived session instances for each use.I Async Document Session