public async Task ExecuteAsyc() { await using var pdbc = _PublishingDbContext(); await using (pdbc.BeginTransaction()) //Read consistency { var move = pdbc.EksOutput.Select( x => new ContentEntity { Created = x.Release, Release = x.Release, ContentTypeName = MediaTypeNames.Application.Zip, Content = x.Content, Type = ContentTypes.ExposureKeySet, PublishingId = _PublishingIdService.Create(x.Content) }).ToArray(); await using var cdbc = _ContentDbContext(); await using (cdbc.BeginTransaction()) { cdbc.Content.AddRange(move); cdbc.SaveAndCommit(); } _Logger.LogInformation($"Published EKSs - Count:{move.Length}."); } }
public async Task <TContentEntity> FillAsync <TContentEntity, TContent>(TContentEntity e, TContent c) where TContentEntity : ContentEntity { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (c == null) { throw new ArgumentNullException(nameof(c)); } var contentJson = _jsonSerializer.Serialize(c); var contentBytes = Encoding.UTF8.GetBytes(contentJson); e.PublishingId = _publishingIdService.Create(contentBytes); e.Content = await _signedFormatter.SignedContentPacketAsync(contentBytes); return(e); }
public async Task ExecuteAsync(ContentArgs args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } var contentBytes = Encoding.UTF8.GetBytes(args.Json); var e = new ContentEntity { Created = _dateTimeProvider.Snapshot, Release = args.Release, Type = args.ContentType, PublishingId = _publishingIdService.Create(contentBytes), Content = await _signedFormatter.SignedContentPacketAsync(contentBytes) }; await _dbContext.Content.AddAsync(e); }
public async Task Execute(ContentArgs args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } var contentBytes = Encoding.UTF8.GetBytes(args.Json); var e = new ContentEntity { Created = _DateTimeProvider.Now(), //TODO audit stamp Release = args.Release, Type = args.ContentType, PublishingId = _PublishingIdService.Create(contentBytes), Content = await _SignedFormatter.SignedContentPacket(contentBytes), ContentTypeName = MediaTypeNames.Application.Zip }; await _DbContext.Content.AddAsync(e); }