public async Task Handle(TaskLinkCreatedEvent notification, CancellationToken cancellationToken) { using (var connection = this._dbConnectionFactory.OpenConnection()) { var repository = new TaskLinksRepository(); await repository.CreateNewLinkbetweenTasksAsync(connection, notification.AggregateId, notification.LinkToTaskId); } }
public void LinkToTask(Guid linkedTaskId) { if (this.TaskLinks.Contains(linkedTaskId)) { throw new DuplicateTaskLinkException(linkedTaskId); } var attachedEvent = new TaskLinkCreatedEvent(this.AggregateId, linkedTaskId); this.RaiseEvent(attachedEvent); }
private void Apply(TaskLinkCreatedEvent obj) { this.TaskLinks.Add(obj.LinkToTaskId); }