Raven Db
Description
RavenDB is used as a Document DB provider behind IFlexDocumentStore. Generated infrastructure manages cluster URLs, certificates, and conventions while your handlers/queries stay consistent across providers.
Important Concepts
Cluster/conventions are centralized: provider wiring handles the Raven document store configuration.
AppContext is mandatory: always call
dto.GetAppContext().Provider-agnostic business code: you depend on
IFlexDocumentStore.
Configuration in DI (where to add)
Provider wiring is generated in your Infrastructure project (under a ...DataStoreProviders/Document/RavenDb folder). You typically do not register individual queries/handlers here — Flex generates and wires those.
If you are wiring Raven manually, add the document-store provider registration where you configure infrastructure services:
// Infrastructure (example)
services.AddFlexRavenDocumentStore<TicketDocument>(configuration);appsettings.json
{
"FlexBase": {
"DataStores": {
"Document": {
"RavenDb": {
"Urls": ["https://raven1.company.local", "https://raven2.company.local"],
"DatabaseName": "{YourApplication}",
"CertificatePath": "<optional path>",
"CertificatePassword": "<optional password>",
"UseOptimisticConcurrency": true
}
}
}
}
}Examples (from the generated templates)
Raven uses the standard DocumentStore templates.
Query example (Get-by-id)
Provider-specific considerations
Certificates: keep cert material in your secrets provider; only reference names/paths in config.
Cluster URLs: prefer multiple URLs for failover.
Indexes: predefine key indexes so queries don’t rely on ad-hoc index creation.
Last updated