Interface ISnapshot
Represents a snapshot of an aggregate's state at a specific version.
public interface ISnapshot
Properties
AggregateId
Gets the aggregate identifier this snapshot belongs to.
string AggregateId { get; }
Property Value
- string
The aggregate identifier this snapshot belongs to.
AggregateType
Gets the type of the aggregate for deserialization.
string AggregateType { get; }
Property Value
- string
The type of the aggregate for deserialization.
CreatedAt
Gets the timestamp when this snapshot was created.
DateTimeOffset CreatedAt { get; }
Property Value
- DateTimeOffset
The timestamp when this snapshot was created.
Data
Gets the serialized state data.
ReadOnlyMemory<byte> Data { get; }
Property Value
- ReadOnlyMemory<byte>
The serialized state data as an immutable memory region.
Metadata
Gets optional metadata about the snapshot.
IDictionary<string, object>? Metadata { get; }
Property Value
- IDictionary<string, object>
Optional metadata about the snapshot.
SnapshotId
Gets the unique identifier for this snapshot.
string SnapshotId { get; }
Property Value
- string
The unique identifier for this snapshot.
TenantId
Gets the tenant this snapshot belongs to, when the host is multi-tenant.
string? TenantId { get; }
Property Value
Remarks
A snapshot is identified by its aggregate, and two tenants can hold the same aggregate identifier. Without a tenant the identity is ambiguous: one tenant's snapshot can be served to another, and a store keyed only on the aggregate cannot hold both at once. This is that discriminator.
Required, deliberately, and NOT defaulted to null. A default would let every implementation inherit "no tenant" without stating it, so a store that never considered tenancy would be indistinguishable from one that considered it and correctly reported none. Requiring the member forces each implementation to answer the question; forgetting is a compile error rather than a silent single-tenant assumption.
null means single-tenant — the correct value for a host that is not multi-tenant. It does not mean "unknown".
Version
Gets the version of the aggregate when this snapshot was created.
long Version { get; }
Property Value
- long
The version of the aggregate when this snapshot was created.