Class EventSourcingOptions
- Namespace
- Stratara.Shared.EventSourcing
- Assembly
- Stratara.Shared.dll
Write-side event-sourcing settings, bound to the EventSourcing configuration section.
[ExcludeFromCodeCoverage]
public sealed class EventSourcingOptions
- Inheritance
-
EventSourcingOptions
- Inherited Members
- Extension Methods
Fields
SectionName
Configuration section name (EventSourcing) that hosts these options.
public const string SectionName = "EventSourcing"
Field Value
Properties
AppendAgainstAggregatedVersion
Gets or sets whether an append to a stream that was rebuilt through the aggregation service in the same unit of work is made on the condition that the stream is still at the version that rebuild saw. Defaults to false.
public bool AppendAgainstAggregatedVersion { get; set; }
Property Value
Remarks
A handler reads a stream, decides on what it read, and appends. Without the condition the append is numbered after whatever the stream holds when it is made, so a write that landed between the read and the append goes unnoticed and the handler's fact is recorded after it. With the condition the save fails with a concurrency conflict instead, which the bus and the Orleans execution model redeliver: the handler runs again and decides on the stream's current state.
The condition is the version of the first such rebuild of the stream; a later rebuild of the same stream in the unit of work does not move it. A rebuild bounded to an earlier version sets no condition; a rebuild of a stream that does not exist sets the condition that it still does not. A successful save ends the condition on the streams it wrote; a failed save ends it on every stream. The cost is that a handler appending to a stream another writer touches concurrently now sees a conflict where it used to succeed, and on the mediator path that conflict reaches the caller.
NewStreamOwnerFromSession
Gets or sets what happens when the first event of a stream that does not exist yet would take its owner from the session — no subject is stated for it, and it is not a creation event that carries a tenant. Defaults to Allow.
public NewStreamOwnerPolicy NewStreamOwnerFromSession { get; set; }
Property Value
Remarks
A stream keeps the owner its first event recorded, so the session decides only that first owner — but it decides it silently, and the session belongs to whoever is acting: an operator creating a record in another tenant keys the record's whole history to their own. Warn finds every place that relies on it; Refuse makes it impossible. Neither affects an event whose owner is stated, a creation event that carries a tenant, or an append to an existing stream.