R – NHibernate using single configuration file to connect to multiple dbs

configurationhibernatenhibernatesession

I'd like to have a single configuration file and then when I'm creating a session change the hibernate-configuration->session-factory->connection.connection_string property to what I want it to be programmatically? Is it possible?

UPDATE:

I believe I may be able to do this like this

Configuration cfg = new Configuration();
cfg.Configure(sessionFactoryConfigPath);

cfg.Properties["connection.connection_string"] = ...

What I would wonder than, if that is ok, Is this a bad way to handle connecting to a different database for each session? if so why etc. I'd also like to know if/how you can open an nhibernate session with a .net connection object?

Related Topic