Esempio n. 1
0
        void IDisposable.Dispose()
        {
            if (_dataConnection != null)
            {
                if (_dataConnection.QueryHints.Count > 0)
                {
                    QueryHints.AddRange(_queryHints);
                }
                if (_dataConnection.NextQueryHints.Count > 0)
                {
                    NextQueryHints.AddRange(_nextQueryHints);
                }

                _dataConnection.Dispose();
                _dataConnection = null;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Closes underlying connection and fires <see cref="OnClosing"/> event (only if connection existed).
        /// </summary>
        void Close()
        {
            if (_dataConnection != null)
            {
                if (OnClosing != null)
                {
                    OnClosing(this, EventArgs.Empty);
                }

                if (_dataConnection.QueryHints.Count > 0)
                {
                    QueryHints.AddRange(_queryHints);
                }
                if (_dataConnection.NextQueryHints.Count > 0)
                {
                    NextQueryHints.AddRange(_nextQueryHints);
                }

                _dataConnection.Dispose();
                _dataConnection = null;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// For active underlying connection, updates information about last executed query <see cref="LastQuery"/> and
        /// releases connection, if it is not locked (<see cref="LockDbManagerCounter"/>)
        /// and <see cref="KeepConnectionAlive"/> is <c>false</c>.
        /// </summary>
        internal void ReleaseQuery()
        {
            if (_dataConnection != null)
            {
                LastQuery = _dataConnection.LastQuery;

                if (LockDbManagerCounter == 0 && KeepConnectionAlive == false)
                {
                    if (_dataConnection.QueryHints.Count > 0)
                    {
                        QueryHints.AddRange(_queryHints);
                    }
                    if (_dataConnection.NextQueryHints.Count > 0)
                    {
                        NextQueryHints.AddRange(_nextQueryHints);
                    }

                    _dataConnection.Dispose();
                    _dataConnection = null;
                }
            }
        }