Esempio n. 1
0
        /// <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));
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Disconnects the active connection when ReuseSingleConnection is enabled.
 /// </summary>
 public void Disconnect()
 {
     if (ReuseSingleConnection)
     {
         ActiveConnection.Close();
     }
 }
Esempio n. 3
0
 public virtual void Close()
 {
     if (ActiveConnection != null &&
         ActiveConnection.State == System.Data.ConnectionState.Open)
     {
         ActiveConnection.Close();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Disposes of this instance, closing the session with the Target.
        /// </summary>
        public void Dispose()
        {
            if (ActiveConnection != null)
            {
                ActiveConnection.Close(LogoutReason.CloseSession);
            }

            ActiveConnection = null;
        }
Esempio n. 5
0
        public void Dispose()
        {
            if (wasOpenTransaction)
            {
                _activeTransaction.Rollback();
                _activeTransaction.Dispose();
                wasOpenTransaction = false;
            }

            if (ActiveConnection != null)
            {
                ActiveConnection.Close();
                ActiveConnection.Dispose();
            }
        }