示例#1
0
        /// <summary>
        /// Revert one event
        /// </summary>
        public void Revert()
        {
            ++revertIndex;

            int eventCount = controlGateway.GetEventCount();

            int currentIndex = CalculateIndex(eventCount);

            if (!IsRevertable(currentIndex))
            {
                return;
            }

            IEvent revertEvent = controlGateway.GetEvent(currentIndex);

            if (revertEvent == null)
            {
                --revertIndex;

                return;
            }

            //when we are reverting , we don't need to log that event
            //therefore we disable it
            controlGateway.SetIsLogEnabled(false);

            eventProcessor.Revert(revertEvent);

            //after reverting the event
            //we should able the event logging feature againg
            controlGateway.SetIsLogEnabled(true);
        }