tags:

views:

23

answers:

0

At the company I work we have a single database schema but with each of our clients using their own dedicated db, with one central db that stores client contact details and what database the client is using so we can connect to the appropriate db. I've looked at using NHibernate Shards but it seems to have gone very quite and doesn't look complete,

Does anyone know the status of this project? Has anyone used it in production?

If it's not yet at a point that is considered usable in production what are the alternatives? The two main ones seem to be...

  1. Create a session factory per db and then a wrapper to select the appropriate factory to generate the correct session - this seems to me to have redundant session factories and not too efficient
  2. Create just one session factory but when calling opensession pass it an IDbConnection - which would allow the session to have a different db connection.

My concern with 2 is how will NHibernate cope with a 2nd level cache as I believe it is controlled by the session factory - also the HiLo generator uses the session factory i believe. In these cases will having sessions attach to different dbs cause problems? For example we will end up with a MyCompany.Model.User class that has an id of 2 in both dbs will this cause conflicts within the cache?

Thanks for any guidance