This project is read-only.

Close Current Connection Switch To Another Database

Mar 26, 2011 at 7:21 AM

Is there a methodology for closing your current connection to the database?  Currently, I set the configvalue and then my first nHydrate call initiates the connection to that database.  In my application, I may want to close that connection and have the user select another database, and then connect to that one.  Does just changing the configvalue cause the current connection to run-down and setup for a new connection on the next nHydrate call?

Mar 27, 2011 at 1:39 AM

All database connections are opened and closed with each call. There is no open calls that just hang around. You can set the connection values static value for ConnectionString to any value you wish at any time. However keep in mind that this is a static property so if you change it all user (in a website0 will be connected to the new database. There is no way to have different website users connect to different copies of the same database at the same time. I am not sure if this is what you are trying to do but I thought I would mention it.