Interface IProjectionDefinition<TState>
- Namespace
- Opossum.Projections
- Assembly
- Opossum.dll
Defines how events are projected into a materialized view state
public interface IProjectionDefinition<TState> where TState : class
Type Parameters
TStateThe projection state type
Properties
EventTypes
Event types this projection subscribes to
string[] EventTypes { get; }
Property Value
- string[]
ProjectionName
Unique name for this projection
string ProjectionName { get; }
Property Value
Methods
Apply(TState?, SequencedEvent)
Applies an event to the current projection state. The full event envelope (payload, tags, metadata, position) is available via Event, Metadata, and Position.
TState? Apply(TState? current, SequencedEvent evt)
Parameters
currentTStateCurrent state (null for new projection instance)
evtSequencedEventThe full sequenced event including payload, tags, metadata, and position
Returns
- TState
Updated state, or null to delete the projection instance
KeySelector(SequencedEvent)
Extracts the key (partition key) from an event for this projection instance
string KeySelector(SequencedEvent evt)
Parameters
evtSequencedEventThe sequenced event
Returns
- string
The key identifying which projection instance to update