Table of Contents

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

TState

The 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

string

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

current TState

Current state (null for new projection instance)

evt SequencedEvent

The 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

evt SequencedEvent

The sequenced event

Returns

string

The key identifying which projection instance to update