public CqlConnection() { _ConnectionState = ConnectionState.Closed; _Config = new CqlConnectionConfiguration(); _CurrentKeyspace = ""; _ActualConnection = null; }
public override void Open() { // TODO: connection pool if (_ConnectionState != ConnectionState.Closed) throw new CqlException("already connected"); _ActualConnection = new ActualCqlConnection(_Config); _ActualConnection.Connect(); _ActualConnection.AssociateWith(this); _ConnectionState = ConnectionState.Open; }
public override void Close() { if (_ConnectionState == ConnectionState.Closed) return; // TODO: connection pool // TODO: when in connection pool, do not disconnect, just return it to the pool! _ActualConnection.DisassociateFrom(this); _ActualConnection.Disconnect(); _ActualConnection = null; }