Hi, I have a multi-tenant web app using NH. Tenants are added and removed at runtime and i'm going with the database per tenant approach.
Basically a request comes in like this: http://tenant1.host.com/whatever I have a HttpModule which takes the "tenant1" part and looks up the Tenant specific config in the Host database. The Host db will contain a table of Tenants. This will then validate that the Tenant exists etc. At this point i need to access the Tenant database. So i need a SessionFactory to create a Session. My question is, how should i approach this. At startup: I could access the Host db and list out all the Tenants, Create a session factory for each one and then put them in a dictionary (to keep the example simple). Then access like: ISession session = sessionFactories[TenantName].CurrentSession(); But if I end up with 1000's of Tenants would that be inefficient. Would I instead: Use one SessionFactory for the Tenants (they are all using the same schema after all), Create a Tenant specific connection and pass it to the SessionFactory, i.e. Factory.OpenSession(TenantSpecificConnection, ......) But this complicates the 2nd level cache management. Any advice??? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
