public EventEntity(Partition partition, RecordedEvent @event) { PartitionKey = partition.PartitionKey; RowKey = partition.EventVersionRowKey(@event.Version); Properties = @event.Properties; Version = @event.Version; }
public EventIdEntity(Partition partition, RecordedEvent @event) { Event = @event; PartitionKey = partition.PartitionKey; RowKey = partition.EventIdRowKey(@event.Id); Version = @event.Version; }
internal StreamWriteResult(Stream stream, RecordedEvent[] events) { Stream = stream; Events = events; Includes = events .SelectMany(x => x.IncludedOperations.Select(y => y.Entity)) .ToArray(); }
Chunk Add(RecordedEvent @event) { if (@event.Operations > MaxOperationsPerChunk) { throw new InvalidOperationException( string.Format("{0} include(s) in event {1}:{{{2}}}, plus event entity itself, is over Azure's max batch size limit [{3}]", @event.IncludedOperations.Length, @event.Version, @event.Id, MaxOperationsPerChunk)); } if (!CanAccomodate(@event)) { return(new Chunk(@event)); } Accomodate(@event); return(this); }
bool CanAccomodate(RecordedEvent @event) { return(operations + @event.Operations <= MaxOperationsPerChunk); }
void Accomodate(RecordedEvent @event) { operations += @event.Operations; events.Add(@event); }
Chunk(RecordedEvent first) => Accomodate(first);