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?
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With