Skip to main content
Table of Contents

Class Snapshot

Namespace
Stratara.Abstractions.EventSourcing
Assembly
Stratara.Abstractions.dll

Aggregate snapshot — periodic state capture that lets the aggregation service skip replaying every event from the start of a stream.

[ExcludeFromCodeCoverage]
public sealed class Snapshot : IEntity, IMultiTenant, IBucket, IHasRowVersion
Inheritance
Snapshot
Implements
Inherited Members
Extension Methods

Remarks

TenantId and UserId are the Subject (data owner) of the aggregate — the owner recorded on the stream's first EventStreamEntry. The snapshot is encrypted under them and read back under them, so an erasure that reaches the stream's events reaches its snapshots too.

Properties

AggregateTypeName

Assembly-qualified type name of the owning aggregate, as produced when the snapshot is written. It carries the assembly version, so reads must match it version-independently (see GetAsync(Guid, string, long?, CancellationToken)).

public required string AggregateTypeName { get; set; }

Property Value

string

BucketId

The bucket index in [0, BucketCount).

public required int BucketId { get; set; }

Property Value

int

DataJson

Serialised aggregate state as JSON.

public required string DataJson { get; set; }

Property Value

string

Id

The entity's primary-key identifier.

public Guid Id { get; set; }

Property Value

Guid

RowVersion

Current row version as read from xmin. Set by EF Core on save.

public uint RowVersion { get; set; }

Property Value

uint

StreamId

Id of the stream the snapshot captures.

public Guid StreamId { get; set; }

Property Value

Guid

TenantId

The Subject (data-owner) tenant id.

public required Guid TenantId { get; set; }

Property Value

Guid

Timestamp

When the snapshot was written.

public DateTimeOffset Timestamp { get; set; }

Property Value

DateTimeOffset

UserId

The owning user recorded on the stream, or null when the stream names none — and on every snapshot written before the owning user was recorded, which is read under TenantId alone, as it was written.

public Guid? UserId { get; set; }

Property Value

Guid?

Version

Stream version the snapshot reflects (inclusive).

public long Version { get; set; }

Property Value

long