Reputation: 5451
I'm using a EmbdeddedDocumentStore
, running in-memory, when unit testing my application.
My account sign-up controller needs to create a new database for the tenant. It's calling EnsureDatabaseExists(newTenantId)
.
This results in the following exception:
Multiple databases are not supported in the embedded API currently
How can I work-around this? Do I have to spin up a non-embedded RavenDB server?
Upvotes: 2
Views: 328
Reputation: 241900
Assuming you want to actually run against an embedded RavenDB in-memory instance during testing, and you are using a full RavenDB server in production, then you can just add some code to check which flavor you are using:
if (!(documentStore is EmbeddableDocumentStore))
documentStore.DatabaseCommands.EnsureDatabaseExists(newTenantId);
You'll also want to make sure you are not trying to switch to the newTenantId
database when opening your session. You may need some conditional logic there as well.
Upvotes: 1
Reputation: 29083
Well the error message seems pretty clear... either change your code to not require multiple databases OR use the non-embedded store OR nag the RavenDB guys to add support for this scenario.
Upvotes: 0