Niclas, ISessionFactory.OpenSession accepts an IDbConnection. Using your favorite IoC framework, create a unit-of-work scoped connection to the specific customer's DB and pass it in to a single application-scoped session factory. I doubt this was the intended purpose, but it may work anyway. I would start there.
Thanks, Jason On Mon, Oct 26, 2009 at 4:12 PM, Niclas Pehrsson <[email protected]> wrote: > > Hi I'm doing some research when using NHibernate with Multi tenancy, I > have choosen to start with multi databases to solve the tenancy > problem. One database per customer. We hope that our product will have > several thousands customers, this will mean several databases. > > Now say that we will host this product and let the login of the > customer decide which database to use for the user, then we need to > have thousands of SessionFactories in the server memory cause we don't > wanna build it each time a user requests for it. > This will take a lot of memory, and some performance for the > sessionfactory lookup, that has been a common solution to solve this > problem by the research I have seen so far. > > So is thousands of loaded sessionfactories a problem? or will it be > fine? > > Can a custom like implementation of a garbage collection be used that > throws out sessionfactories that hasn't been used for a time solve > this problem? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
