Ejemplo n.º 1
0
        /// <summary>
        /// Free, release, or reset managed or unmanaged resources.
        /// </summary>
        /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param>
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                Profiler.OnError("Connection already disposed!");
            }

            if (disposing && WrappedConnection != null)
            {
                if (State != ConnectionState.Closed)
                {
                    Close();
                }

                WrappedConnection.StateChange -= StateChangeHandler;
                WrappedConnection.Dispose();
            }
            _disposed         = true;
            WrappedConnection = null;
            Profiler          = null;

            // corefx calls Close() in Dispose() without checking ConnectionState.
#if !NETSTANDARD1_6
            base.Dispose(disposing);
#endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Free, release, or reset managed or unmanaged resources.
        /// </summary>
        /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param>
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (!_leaveOpen)
                {
                    if (WrappedConnection != null)
                    {
                        if (State != ConnectionState.Closed)
                        {
                            Close();
                        }

                        WrappedConnection.StateChange -= StateChangeHandler;
                        WrappedConnection.Dispose();
                    }

                    WrappedConnection = null;
                }

                Profiler = null;
            }

            // corefx calls Close() in Dispose() without checking ConnectionState.
#if !NETSTANDARD1_6
            base.Dispose(disposing);
#endif

            _disposed = true;
        }
Ejemplo n.º 3
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         WrappedConnection.Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    WrappedConnection.Dispose();
                }

                _disposedValue = true;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Free, release, or reset managed or unmanaged resources.
        /// </summary>
        /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && WrappedConnection != null)
            {
                if (State != ConnectionState.Closed)
                {
                    Close();
                }

                WrappedConnection.StateChange -= StateChangeHandler;
                WrappedConnection.Dispose();
            }

            WrappedConnection = null;
            Profiler          = null;

            // corefx calls Close() in Dispose() without checking ConnectionState.
#if !COREFX
            base.Dispose(disposing);
#endif
        }