Beispiel #1
0
        private async Task HandleEvent(StreamSubscription subscription, ResolvedEvent resolvedEvent,
                                       CancellationToken cancellationToken)
        {
            var domainEvent = _eventSerializer.Deserialize(resolvedEvent);

            if (domainEvent == null)
            {
                return;
            }

            _logger.LogInformation($"PullRequestCommentsProjector handled event: {domainEvent}");
            switch (domainEvent)
            {
            case SingleCommentWasAdded added:
                var comment = new PullRequestComment
                {
                    PullRequestId = added.PullRequestId,
                    CommentId     = added.CommentId,
                    PostedAt      = added.OccurredAt,
                    Author        = added.Author,
                    Text          = added.Text
                };
                await _repository.Save(comment);

                break;
            }
        }
 protected bool Equals(PullRequestComment other)
 {
     return(PullRequestId == other.PullRequestId && CommentId == other.CommentId &&
            PostedAt.Equals(other.PostedAt) && Author == other.Author && Text == other.Text);
 }