Skip to content

Mark a Cratis Chronicle model-bound projection as not rewindable

[NotRewindable] sets IsRewindable to false on a Cratis Chronicle model-bound projection definition. Use it to declare that the projection is intended to move forward only.

In C#, apply the attribute to the read model type:

using Cratis.Chronicle.Events;
using Cratis.Chronicle.Keys;
using Cratis.Chronicle.Projections.ModelBound;
[EventType]
public record MbNotRewindableAuditEvent(string Message, DateTimeOffset OccurredAt);
[NotRewindable]
public record MbNotRewindableAuditLog(
[Key]
Guid Id,
[SetFrom<MbNotRewindableAuditEvent>(nameof(MbNotRewindableAuditEvent.Message))]
string Message,
[SetFrom<MbNotRewindableAuditEvent>(nameof(MbNotRewindableAuditEvent.OccurredAt))]
DateTimeOffset Timestamp);

View C# snippet source on GitHub

The example marks MbNotRewindableAuditLog as not rewindable while keeping its event-to-property mappings unchanged. Without the attribute, the model-bound builder sets IsRewindable to true.

This projection setting is separate from observer replayability. It does not configure how a reactor handles historical events; see Observers for replay policy and Reactor replay handlers for replay-specific work.