/// <summary> /// Opens a database connection with the property settings specified by the <see cref="ConnectionString" />. /// </summary> /// <remarks> /// The <see cref="AseConnection" /> draws an open connection from the connection pool if one is available. /// Otherwise, it establishes a new connection to an instance of ASE. /// </remarks> public override void Open() { if (_isDisposed) { throw new ObjectDisposedException(nameof(AseConnection)); } if (State == ConnectionState.Open) { return; //already open } if (State != ConnectionState.Closed) { throw new InvalidOperationException("Cannot open a connection which is not closed"); } InternalState = ConnectionState.Connecting; var parameters = ConnectionParameters.Parse(_connectionString); _internal = _connectionPoolManager.Reserve(_connectionString, parameters); InternalConnectionTimeout = parameters.LoginTimeout; InternalState = ConnectionState.Open; }
/// <summary> /// Opens a database connection with the property settings specified by the <see cref="ConnectionString" />. /// </summary> /// <remarks> /// The <see cref="AseConnection" /> draws an open connection from the connection pool if one is available. /// Otherwise, it establishes a new connection to an instance of ASE. /// </remarks> public override void Open() { if (_isDisposed) { throw new ObjectDisposedException(nameof(AseConnection)); } if (State == ConnectionState.Open) { return; //already open } if (State != ConnectionState.Closed) { throw new InvalidOperationException("Cannot open a connection which is not closed"); } InternalState = ConnectionState.Connecting; try { var parameters = ConnectionParameters.Parse(_connectionString); _internal = _connectionPoolManager.Reserve(_connectionString, parameters, _eventNotifier, UserCertificateValidationCallback); InternalConnectionTimeout = parameters.LoginTimeout; } catch (Exception) { InternalState = ConnectionState.Closed; throw; } InternalState = ConnectionState.Open; }