Class EventUpcasterPipeline
- Namespace
- Stratara.Abstractions.EventSourcing
- Assembly
- Stratara.Abstractions.dll
Default IEventUpcasterPipeline. Indexes the registered IEventUpcaster instances by their version-independent SourceEventTypeName and applies them in a chain on read. With no upcasters registered it is a transparent pass-through and never parses the payload.
public sealed class EventUpcasterPipeline : IEventUpcasterPipeline
- Inheritance
-
EventUpcasterPipeline
- Implements
- Inherited Members
- Extension Methods
Remarks
Registered as a singleton by the event-mapping DI wiring; the set of upcasters is captured once at construction. Two upcasters claiming the same source type name is a configuration error and throws.
Constructors
EventUpcasterPipeline(IEnumerable<IEventUpcaster>)
Initializes the pipeline from the registered upcasters.
public EventUpcasterPipeline(IEnumerable<IEventUpcaster> upcasters)
Parameters
upcastersIEnumerable<IEventUpcaster>Every IEventUpcaster registered in the container.
Exceptions
- ArgumentNullException
upcastersisnull.- InvalidOperationException
Two upcasters declare the same source event type name.
Methods
Upcast(string, string)
Runs the upcaster chain for a single persisted event.
public UpcastedEvent Upcast(string eventTypeName, string dataJson)
Parameters
eventTypeNamestringThe event type name as persisted in the event row.
dataJsonstringThe event payload as persisted (JSON).
Returns
- UpcastedEvent
The effective type name and payload after upcasting. When no upcaster matches, the inputs are returned unchanged.
Exceptions
- InvalidOperationException
The upcaster chain is cyclic.