public async Task Execute(ICommandExecutionContext context) { await context.GetEventService().Raise(new TextUpdated { AggregateId = this.PostId, Text = this.Text, }); }
public async Task Execute(ICommandExecutionContext context) { await context.GetEventService().Raise(new CreatedAsDraft { AggregateId = this.PostId, Title = this.PostTitle, }); }
public async Task Execute(ICommandExecutionContext context) { await context.GetEventService().Raise(new Published { AggregateId = this.PostId, PublicationDate = context.GetTimeService().Now(), }); }
public async Task Execute(ICommandExecutionContext context) { this.Result = await context.GetEventService().Raise(new TodoListCreatedEvent { AggregateId = context.GetIdGenerator().GenerateId(), Name = this.Name, Date = context.GetTimeService().Now(), }); }
public async Task Execute(RegisterUserCommand command, ICommandExecutionContext context) { await context.GetEventService().Raise(new Registered { AggregateId = command.Username, EmailAddress = command.EmailAddress, RegistrationDate = context.GetTimeService().Now(), }); }
public async Task Execute(ICommandExecutionContext context) { await context.GetEventService().Raise(new ErrorLoggedEvent { Message = this.Message, AggregateId = context.GetIdGenerator().GenerateId(), Description = this.Description, }); }
public async Task Execute(ICommandExecutionContext context) { var list = await this.TodoLists.GetById(this.TodoListId); this.Result = await context.GetEventService().Raise(new TodoCreatedEvent { AggregateId = context.GetIdGenerator().GenerateId(), Text = this.Text, TodoListId = list.Id, TodoListName = list.Name, }); }
public override async Task Execute(ICommandExecutionContext context) { var repository = context.Teclyn.Get <IRepository <TAggregate> >(); var aggregate = await repository.GetById(this.AggregateId); var oldValue = this.PropertyAccessor(aggregate); if (oldValue == null && this.NewValue != null || oldValue != null && !oldValue.Equals(NewValue)) { var @event = Activator.CreateInstance <TEvent>(); @event.OldValue = oldValue; @event.NewValue = this.NewValue; @event.AggregateId = this.AggregateId.Value; await context.GetEventService().Raise(@event); } }