Example #1
0
        public void PublishMessage <T>(T message, bool saveToEventStore) where T : class, IMessage
        {
            var item = message as ICommand;

            if (item != null)
            {
                PublishedCommands.Add(item);
            }

            IDomainEvent domainEvent;

            if ((domainEvent = message as IDomainEvent) != null)
            {
                if (saveToEventStore)
                {
                    _eventRepository.SaveEvent(domainEvent);
                }
                PublishedEventCount++;
            }

            _undispatchedMessages.Add(message);
            DispatchMessages();
        }
 public void Publish <TCommand>(TCommand command)
     where TCommand : ICommand <ISingleSignOnToken>
 {
     PublishedCommands.Add(command);
 }