private void Updated(DocmsContext ctx, string path, int contentId)
        {
            var now = DateTime.UtcNow;

            ctx.DocumentHistories.Add(DocumentHistory.DocumentUpdated(
                                          DateTime.UtcNow,
                                          contentId,
                                          path,
                                          "stragekey",
                                          "text/plain",
                                          5 + contentId.ToString().Length,
                                          Hash.CalculateHash(Encoding.UTF8.GetBytes("Hello" + contentId)),
                                          now,
                                          now));
        }
Пример #2
0
        public async Task Handle(DomainEventNotification <DocumentUpdatedEvent> notification, CancellationToken cancellationToken = default)
        {
            var ev = notification.Event;

            _db.DocumentHistories
            .Add(DocumentHistory.DocumentUpdated(
                     ev.Timestamp,
                     ev.Entity.Id,
                     ev.Path.ToString(),
                     ev.Data.StorageKey,
                     ev.ContentType,
                     ev.Data.Length,
                     ev.Data.Hash,
                     ev.Created,
                     ev.LastModified));
            await _db.SaveChangesAsync();
        }