public IDbConnection GetConnection() {
if (this.isDisposed) {
throw new ObjectDisposedException("Session");
}
if (this.connection.State == ConnectionState.Closed || this.connection.State == ConnectionState.Connecting) {
lock (this.connectionOpenLock) {
if (this.connection.State == ConnectionState.Closed) {
this.connection.Open();
}
}
}
if (this.connection.State != ConnectionState.Open) {
throw new Exception("Connection in unknown state");
}
return this.connection;
}