/// <summary> /// Disconnects this instance. /// </summary> public void Disconnect( ) { lock ( _syncRoot ) { if (ActiveConnection != null) { string host = null; if (ActiveConnection.Configuration != null) { ConfigurationOptions configurationOptions = ConfigurationOptions.Parse(ActiveConnection.Configuration); if (configurationOptions.EndPoints != null && configurationOptions.EndPoints.Count > 0) { host = GetEndPointHost(configurationOptions.EndPoints[0]); } } ActiveConnection.Close( ); ActiveConnection.Dispose( ); ActiveConnection = null; EventLog.Application.WriteInformation("Connection to Redis server{0} closed.", string.IsNullOrEmpty(host) ? string.Empty : string.Format(" ('{0}')", host)); } } }
/// <summary> /// Disconnects the active connection when ReuseSingleConnection is enabled. /// </summary> public void Disconnect() { if (ReuseSingleConnection) { ActiveConnection.Close(); } }
public virtual void Close() { if (ActiveConnection != null && ActiveConnection.State == System.Data.ConnectionState.Open) { ActiveConnection.Close(); } }
/// <summary> /// Disposes of this instance, closing the session with the Target. /// </summary> public void Dispose() { if (ActiveConnection != null) { ActiveConnection.Close(LogoutReason.CloseSession); } ActiveConnection = null; }
public void Dispose() { if (wasOpenTransaction) { _activeTransaction.Rollback(); _activeTransaction.Dispose(); wasOpenTransaction = false; } if (ActiveConnection != null) { ActiveConnection.Close(); ActiveConnection.Dispose(); } }