Ejemplo n.º 1
0
        private void LogEventStore(State stateAfter)
        {
            if (LogLevel == StateEventLogLevel.None)
            {
                return;
            }
            var eventStoreBefore = Store.GetEventStore(stateBefore);
            var eventStoreAfter  = Store.GetEventStore(stateAfter);

            if (eventStoreBefore.ProgressId != eventStoreAfter.ProgressId)
            {
                Logger.Log(
                    "EventStoreProgress - before: " + eventStoreBefore.ProgressId + ", after: " + eventStoreAfter.ProgressId
                    );
            }

            var eventStoreListRemoved = eventStoreBefore.Store / eventStoreAfter.Store;
            var eventStoreListAdded   = eventStoreAfter.Store / eventStoreBefore.Store;

            if (eventStoreListRemoved.Count > 0)
            {
                Logger.Log("removed events:");
                Im.Each(LogEvent, eventStoreListRemoved);
            }

            if (eventStoreListAdded.Count > 0)
            {
                Logger.Log("added events:");
                Im.Each(LogEvent, eventStoreListAdded);
            }

            var outboxRemoved = eventStoreBefore.Outbox / eventStoreAfter.Outbox;
            var outboxAdded   = eventStoreAfter.Outbox / eventStoreBefore.Outbox;

            if (outboxRemoved.Count > 0)
            {
                Logger.Log("removed events from outbox:");
                Im.Each(LogEvent, outboxRemoved);
            }

            if (outboxAdded.Count > 0)
            {
                Logger.Log("added events to outbox:");
                Im.Each(LogEvent, outboxAdded);
            }

            if (LogLevel != StateEventLogLevel.Full)
            {
                return;
            }

            if (eventStoreListRemoved.Count > 0 || eventStoreListAdded.Count > 0)
            {
                Logger.Log("event store");
                Im.Each(LogEvent, eventStoreAfter.Store);
            }

            if (outboxRemoved.Count > 0 || outboxAdded.Count > 0)
            {
                Logger.Log("event outbox");
                Im.Each(LogEvent, eventStoreAfter.Outbox);
            }
        }
Ejemplo n.º 2
0
 public void Each(Action <EventParameter> iterator)
 {
     Im.Each(iterator, Parameters);
 }