Beispiel #1
0
        /// <summary>
        /// Rollback the current UOW.
        ///</summary>
        /// <param name='nDepth'>[Not used.]</param>
        /// <exception cref="InvalidOperationException">
        /// Thrown if not in the right state to do
        /// a rollback (in the data change phase of the UOW).
        /// </exception>
        public void Rollback(int nDepth)
        {
            if (this != m_uowService.ActiveUndoStack)
            {
                m_uowService.ActiveUndoStack.Rollback(nDepth);
                return;
            }
            if (m_uowService.CurrentProcessingState != UnitOfWorkService.FdoBusinessTransactionState.ProcessingDataChanges)
            {
                throw new InvalidOperationException("Rollback not supported in the current state.");
            }

            Debug.Assert(m_uowService.m_lock.IsWriteLockHeld, "Trying Rollback without write lock!");
            if (m_uowService.m_lock.IsWriteLockHeld)
            {
                m_uowService.m_lock.ExitWriteLock();
            }
            else
            {
                Logger.WriteEvent("Trying to rollback without write lock!");
            }

            m_currentBundle.Rollback();
            m_currentBundle = null;
            m_actionsToDoAtEndOfPropChanged.Clear();             // don't do them on some subsequent task
            m_uowService.CurrentProcessingState = UnitOfWorkService.FdoBusinessTransactionState.ReadyForBeginTask;
        }
Beispiel #2
0
        /// <summary>
        /// Rollback the current UOW.
        ///</summary>
        /// <param name='nDepth'>[Not used.]</param>
        /// <exception cref="InvalidOperationException">
        /// Thrown if not in the right state to do
        /// a rollback (in the data change phase of the UOW).
        /// </exception>
        public void Rollback(int nDepth)
        {
            if (this != m_uowService.ActiveUndoStack)
            {
                m_uowService.ActiveUndoStack.Rollback(nDepth);
                return;
            }
            if (m_uowService.CurrentProcessingState != UnitOfWorkService.FdoBusinessTransactionState.ProcessingDataChanges)
            {
                throw new InvalidOperationException("Rollback not supported in the current state.");
            }

            m_uowService.m_lock.ExitWriteLock();

            m_currentBundle.Rollback();
            m_currentBundle = null;
            RaisePropChangedCompleted(true);
            m_uowService.CurrentProcessingState = UnitOfWorkService.FdoBusinessTransactionState.ReadyForBeginTask;
        }