/// <summary>
        /// Disposes of the command and clears all member variables
        /// </summary>
        /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (disposing)
            {
                // If a reader is active on this command, don't destroy the command, instead let the reader do it
                SQLiteDataReader reader = null;
                if (_activeReader != null)
                {
                    try
                    {
                        reader = _activeReader.Target as SQLiteDataReader;
                    }
                    catch (InvalidOperationException)
                    {
                    }
                }

                if (reader != null)
                {
                    reader._disposeCommand = true;
                    _activeReader          = null;
                    return;
                }

                Connection = null;
                _parameterCollection.Clear();
                _commandText = null;
            }
        }
Exemple #2
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of the command and clears all member variables
        /// </summary>
        /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
        protected override void Dispose(bool disposing)
        {
            bool skippedDispose = false;

            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        // If a reader is active on this command, don't destroy the command, instead let the reader do it
                        SQLiteDataReader reader = null;
                        if (_activeReader != null)
                        {
                            try
                            {
                                reader = _activeReader.Target as SQLiteDataReader;
                            }
                            catch (InvalidOperationException)
                            {
                            }
                        }

                        if (reader != null)
                        {
                            reader._disposeCommand = true;
                            _activeReader          = null;
                            skippedDispose         = true;
                            return;
                        }

                        Connection = null;
                        _parameterCollection.Clear();
                        _commandText = null;
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                if (!skippedDispose)
                {
                    base.Dispose(disposing);

                    //
                    // NOTE: Everything should be fully disposed at this point.
                    //
                    disposed = true;
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Disposes of the command and clears all member variables
        /// </summary>
        /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            // If a reader is active on this command, don't destroy it completely
            if (_activeReader != null)
            {
                _activeReader._disposeCommand = true;
                return;
            }

            Connection = null;
            _parameterCollection.Clear();
            _commandText = null;
        }