public void Handle(CreateBusEventRequest command) { this.ValidateCreateBusEventRequest(command); BusEventAggregate aggregate = AggregateFactory.Create <BusEventAggregate>(); aggregate.CreateEventContent(command.Key, command.Content); using (IUnitOfWork uow = this.CreateUnitOfWork <BusEventAggregate>()) { Repository.IBusEventRepository repo = IoC.Container.Resolve <Repository.IBusEventRepository>(uow); repo.Add(aggregate); uow.Commit(); aggregate.PublishEvents(); } }
public CreateMessageBusEventResponse CreateMessage(CreateBusEventRequest ev) { this.Execute(ev); /// need to consider how to return response data to caller return(new CreateMessageBusEventResponse()); }
private void ValidateCreateBusEventRequest(CreateBusEventRequest command) { IValidationException validation = ValidationHelper.Validate(command); validation.ThrowIfError(); }