In a multitenant RavenDB application (one database per tenant, and one 'overview' database with general tenant data), what would be the index creation strategy? (asp.net mvc)
In a simple (not multitenant) application, you can create the indexes in global.asax.
So what would be the best practice as for how and when to create these indexes?
You can use this method on application startup, no worries about perf.
public static void CreateIndexesForDatabases(Assembly assemblyToScanForIndexingTasks, IDocumentStore documentStore, string[] databases)
{
var catalog = new CompositionContainer(new AssemblyCatalog(assemblyToScanForIndexingTasks));
foreach (var database in databases)
{
IndexCreation.CreateIndexes(catalog, documentStore.DatabaseCommands.ForDatabase(database), documentStore.Conventions);
}
}
just don't forget to include Raven.Client.Extensions
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With