Table of Contents

Interface IProjectionWithRelatedEvents<TState>

Namespace
Opossum.Projections
Assembly
Opossum.dll

Defines a projection that fetches related events from the event store to build its state. The framework will automatically load related events before calling Apply.

public interface IProjectionWithRelatedEvents<TState> : IProjectionDefinition<TState> where TState : class

Type Parameters

TState

The projection state type

Inherited Members

Methods

Apply(TState?, SequencedEvent, SequencedEvent[])

Applies an event to the current projection state with access to related events. The framework guarantees that related events (from GetRelatedEventsQuery) are loaded.

TState? Apply(TState? current, SequencedEvent evt, SequencedEvent[] relatedEvents)

Parameters

current TState

Current state (null for new projection instance)

evt SequencedEvent

The full sequenced event including payload, tags, metadata, and position

relatedEvents SequencedEvent[]

Related events loaded by the framework (empty array if none)

Returns

TState

Updated state, or null to delete the projection instance

GetRelatedEventsQuery(SequencedEvent)

Determines what related events to load for a given event. Called by the framework before Apply to fetch additional context.

Query? GetRelatedEventsQuery(SequencedEvent evt)

Parameters

evt SequencedEvent

The full sequenced event being processed

Returns

Query

Query for related events, or null if no related events needed