Issue
I need to directly access the database on a nhibernate application. I am trying to get the connection string like this:
using (SqlConnection conn = new SqlConnection(this.session.Connection.ConnectionString))
But this will return the connection string WITHOUT the password.
I'm I doing something wrong? Is there any other way to get the connection string?
Solution
You can obtain a raw database connection (using the same connection details as NHibernate) from the NHibernate SessionFactory, e.g.:
IDbConnection connection = yourSessionFactory.ConnectionProvider.GetConnection()
Answered By - JulianM