We’re about to migrate a multi-tenant system to NServiceBus. Currently all the tenant connection strings are stored in a global database. As a consequence we would need to connect to the global database to get the connection string for that tenant in the MultiTenantConnectionBuilder
delegate. As described here Multi-tenant support • Sql Persistence • Particular Docs
Now I can imagine this will have a significant performance penalty because of that connection to the database. And we also have to do IO in a sync call which is not ideal.
Moving the tenant connection strings out of that database is not something we can do right now, hopefully later.
Now, I’m thinking to create a dictionary outside and use it as a cache in the MultiTenantConnectionBuilder
to only get each tenant connection string from the database once.
Do you consider this a good idea? Are there other approaches I’m missing?
Thanks,
Philipp