Exemplo n.º 1
0
 public override void Do()
 {
     for (int i = 0; i < actions.Count; i++)
     {
         DocLogger.WriteLineVerbose("DO: " + actions[i].ToString());
         actions[i].Do();
     }
 }
Exemplo n.º 2
0
 public override void Undo()
 {
     for (int i = actions.Count - 1; i >= 0; i--)
     {
         DocLogger.WriteLineVerbose("UNDO: " + actions[i].ToString());
         actions[i].Undo();
     }
 }
Exemplo n.º 3
0
        public override void Undo()
        {
            DocLogger.WriteLine(">>> Undo id=" + Id + " name=\"" + Name + "\"");

            base.Undo();

            DocLogger.WriteLine("<<<");
        }
Exemplo n.º 4
0
        private void RollBackTransaction()
        {
            CheckNotInAction();
            CheckInTransaction();

            Transaction tmp = transaction;

            transaction = null;

            tmp.Undo();

            DocLogger.WriteLine("<<< ROLLBACK");
        }
Exemplo n.º 5
0
        private void PerformUndo(IAtomicOperation action)
        {
            CheckNotInAction();

            DocLogger.WriteLineVerbose("Undo: " + action.ToString());

            try
            {
                currentlyInAction = true;

                action.Undo();
            }
            finally
            {
                currentlyInAction = false;
            }
        }
Exemplo n.º 6
0
        public void StartTransaction(int id, string name)
        {
            CheckThreadId();
            CheckNotInAction();
            CheckNotInTransaction();

            if (HasLastTransaction() && LastTransactionId() == id)
            {
                DocLogger.WriteLine(">>> StartTransaction.Restore id=" + id + " name=\"" + name + "\"");
                RestoreLastTransaction();
            }
            else
            {
                DocLogger.WriteLine(">>> StartTransaction.New id=" + id + " name=\"" + name + "\"");
                transaction = new Transaction(id, name);
            }
        }
Exemplo n.º 7
0
        public void EndTransaction()
        {
            CheckThreadId();
            CheckNotInAction();
            CheckInTransaction();

            Transaction tmp = transaction;

            transaction = null;

            if (tmp.HasActions)
            {
                usedTransactioIds.Add(tmp.Id);
                PerformAdd(tmp);
            }

            PerformNotifications();

            DocLogger.WriteLine("<<<");
        }