1

We are in the process of splitting our db into several smaller ones. The schemas will be exactly the same and we will control which db the system connects to when the client logs in. I receive an error if I do not set a connection string in my nhibernate configuration. I do not want to create a factory for each db. Is it possible to have a session factory provide a Session that I can set the connection string before using it?

2 Answers 2

1

Have not used it but there is a method ChangedDatabase on the Session.Connection. Maybe that would work?

Sign up to request clarification or add additional context in comments.

2 Comments

does factory.OpenSession create a new session each time or is it cached?
each time, and it is in-expensive operation.
0

Maybe you can use NHibernate.Shards, in the NHcontrib repository

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.