예제 #1
0
        /// <summary>
        /// This will rollback the transaction by not writing the table of contents to the file.
        /// </summary>
        /// <remarks>Duplicate calls to this function, or subsequent calls to CommitTransaction will throw an exception</remarks>
        public void RollbackAndDispose()
        {
            if (m_disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            foreach (SubFileStream file in m_openedFiles)
            {
                if (file != null && !file.IsDisposed)
                {
                    file.Dispose();
                }
            }
            try
            {
                m_dataReader.RollbackChanges();
                if (m_delHasBeenRolledBack != null)
                {
                    m_delHasBeenRolledBack.Invoke();
                }
            }
            finally
            {
                m_delHasBeenCommitted  = null;
                m_delHasBeenRolledBack = null;
                m_disposed             = true;
                GC.SuppressFinalize(this);
            }
        }