public void PublishWith(IPublishDomainEvent publisher)
 {
     if (publisher == null) throw new ArgumentNullException("publisher");
     while (_events.Count > 0)
     {
         publisher.Publish(_events.Dequeue());
     }
 }
Exemple #2
0
 internal void PublishEvent <TEvent>(TEvent evnt) where TEvent : IDomainEvent
 {
     foreach (var s in GetHandlers(evnt))
     {
         s.Handle(evnt);
     }
     if (_parent != null)
     {
         _parent.Publish(evnt);
     }
 }
Exemple #3
0
 public void PublishWith(IPublishDomainEvent publisher)
 {
     if (publisher == null)
     {
         throw new ArgumentNullException("publisher");
     }
     while (_events.Count > 0)
     {
         publisher.Publish(_events.Dequeue());
     }
 }
        public override void OnNext(EntityCreatedEvent <Forum> value)
        {
            //if successful
            _publisher.Publish(new LoggingEvent(value.Data.Name));

            var newTask = new Tasks {
                Name = "New Task", Forum = value.Data
            };

            _tasksRepo.Add(newTask);
        }
        public async Task <DrawSubmission> Submit(string firstName, string lastname, EmailAddress emailAddress, SerialNumber serialNumber)
        {
            if (serialNumber == null)
            {
                throw new ArgumentNullException(nameof(serialNumber));
            }

            serialNumber.Use();

            var submission = new DrawSubmission(
                firstName: firstName,
                lastName: lastname,
                emailAddress: emailAddress,
                serialNumber: serialNumber);
            await _dbContext.DrawSubmissions.AddAsync(submission);

            eventPublisher.Publish(new DrawSubmissionRetrievedDomainEvent(submission.Id, emailAddress.Value));

            return(submission);
        }