コード例 #1
0
 public void Undo()
 {
     if (!Executed)
     {
         throw new CommandNotExecutedException();
     }
     if (!_Db.RemoveLink(_ParentNode, _ChildNode))
     {
         throw new CommandFailedDbWriteException();
     }
     _ParentNode.RemoveChild(_ChildNode);
     _ChildNode.RemoveParent(_ParentNode);
     Executed = false;
 }
コード例 #2
0
 public void Execute()
 {
     if (Executed)
     {
         throw new CommandAlreadyExecutedException();
     }
     if (!_Db.RemoveLink(_ParentNode, _ChildNode))
     {
         throw new CommandFailedDbWriteException();
     }
     _ParentNode.RemoveChild(_ChildNode);
     _ChildNode.RemoveParent(_ParentNode);
     Executed = true;
 }