public async Task Handle(NoteMergedEvent notification, CancellationToken cancellationToken)
    {
        var note = await _readModelRepository.GetAsync <NoteDetail>(notification.AggregateId);

        note.When(notification);

        await _readModelRepository.UpdateAsync(note);

        var noteHistory = new NoteHistory
        {
            Id           = Guid.NewGuid(),
            NoteId       = note.Id,
            Title        = note.Title,
            Content      = note.Content,
            Version      = note.Version,
            CreationTime = notification.OccurrenceTime,
            CloneFormId  = note.CloneFormId,
            Comment      = $"Merge from {notification.SourceNoteId}"
        };

        await _readModelRepository.InsertAsync(noteHistory);
    }
Exemple #2
0
 public void When(NoteMergedEvent @event)
 {
     Title    = @event.Title;
     Content  = @event.Content;
     Version += 1;
 }
Exemple #3
0
 private void When(NoteMergedEvent @event)
 {
     _title   = @event.Title;
     _content = @event.Content;
 }