Class EventContext
Represents the context in which an event exists in - typically what it was appended with.
public record EventContext : IEquatable<EventContext>
- Inheritance
-
EventContext
- Implements
- Inherited Members
Constructors
EventContext(EventType, EventSourceType, EventSourceId, EventStreamType, EventStreamId, EventSequenceNumber, DateTimeOffset, EventStoreName, EventStoreNamespaceName, CorrelationId, IEnumerable<Causation>, Identity, IEnumerable<Tag>, EventHash, EventObservationState)
Represents the context in which an event exists in - typically what it was appended with.
public EventContext(EventType EventType, EventSourceType EventSourceType, EventSourceId EventSourceId, EventStreamType EventStreamType, EventStreamId EventStreamId, EventSequenceNumber SequenceNumber, DateTimeOffset Occurred, EventStoreName EventStore, EventStoreNamespaceName Namespace, CorrelationId CorrelationId, IEnumerable<Causation> Causation, Identity CausedBy, IEnumerable<Tag> Tags, EventHash Hash, EventObservationState ObservationState = EventObservationState.Initial)
Parameters
EventTypeEventTypeThe EventType of the event.
EventSourceTypeEventSourceTypeThe EventSourceType.
EventSourceIdEventSourceIdThe EventSourceId.
EventStreamTypeEventStreamTypeThe EventStreamType.
EventStreamIdEventStreamIdThe EventStreamId.
SequenceNumberEventSequenceNumberThe EventSequenceNumber of the event as persisted in the event sequence.
OccurredDateTimeOffsetWhen it occurred.
EventStoreEventStoreNameThe EventStoreName the event belongs to.
NamespaceEventStoreNamespaceNameThe EventStoreNamespaceName the event belongs to.
CorrelationIdCorrelationIdThe CorrelationId for the event.
CausationIEnumerable<Causation>A collection of Causation for what caused the event.
CausedByIdentityA collection of Identities that caused the event.
TagsIEnumerable<Tag>The tags associated with the event.
HashEventHashThe EventHash of the event content.
ObservationStateEventObservationStateHolds the state relevant for the observer observing.
Fields
Empty
Creates an 'empty' EventContext with the event source id set to empty and all properties default.
public static readonly EventContext Empty
Field Value
- EventContext
A new EventContext.
Properties
Causation
A collection of Causation for what caused the event.
public IEnumerable<Causation> Causation { get; init; }
Property Value
CausedBy
A collection of Identities that caused the event.
public Identity CausedBy { get; init; }
Property Value
CorrelationId
The CorrelationId for the event.
public CorrelationId CorrelationId { get; init; }
Property Value
EventSourceId
The EventSourceId.
public EventSourceId EventSourceId { get; init; }
Property Value
EventSourceType
The EventSourceType.
public EventSourceType EventSourceType { get; init; }
Property Value
EventStore
The EventStoreName the event belongs to.
public EventStoreName EventStore { get; init; }
Property Value
EventStreamId
The EventStreamId.
public EventStreamId EventStreamId { get; init; }
Property Value
EventStreamType
The EventStreamType.
public EventStreamType EventStreamType { get; init; }
Property Value
EventType
The EventType of the event.
public EventType EventType { get; init; }
Property Value
Hash
The EventHash of the event content.
public EventHash Hash { get; init; }
Property Value
Namespace
The EventStoreNamespaceName the event belongs to.
public EventStoreNamespaceName Namespace { get; init; }
Property Value
ObservationState
Holds the state relevant for the observer observing.
public EventObservationState ObservationState { get; init; }
Property Value
Occurred
When it occurred.
public DateTimeOffset Occurred { get; init; }
Property Value
SequenceNumber
The EventSequenceNumber of the event as persisted in the event sequence.
public EventSequenceNumber SequenceNumber { get; init; }
Property Value
Tags
The tags associated with the event.
public IEnumerable<Tag> Tags { get; init; }
Property Value
Methods
EmptyWithEventSourceId(EventSourceId)
Creates an empty EventContext for a specific EventSourceId.
public static EventContext EmptyWithEventSourceId(EventSourceId eventSourceId)
Parameters
eventSourceIdEventSourceIdEventSourceId to create for.
Returns
- EventContext
A new EventContext.
From(EventStoreName, EventStoreNamespaceName, EventType, EventSourceType, EventSourceId, EventStreamType, EventStreamId, EventSequenceNumber, CorrelationId, DateTimeOffset?)
Creates a new EventContext from EventSourceId and other optional parameters.
public static EventContext From(EventStoreName eventStore, EventStoreNamespaceName @namespace, EventType eventType, EventSourceType eventSourceType, EventSourceId eventSourceId, EventStreamType eventStreamType, EventStreamId eventStreamId, EventSequenceNumber sequenceNumber, CorrelationId correlationId, DateTimeOffset? occurred = null)
Parameters
eventStoreEventStoreNameEventStoreName the context is for.
namespaceEventStoreNamespaceNameEventStoreNamespaceName the context is for.
eventTypeEventTypeEventType to create from.
eventSourceTypeEventSourceTypeEventSourceType to create from.
eventSourceIdEventSourceIdEventSourceId to create from.
eventStreamTypeEventStreamTypeEventStreamType to create from.
eventStreamIdEventStreamIdEventStreamId to create from.
sequenceNumberEventSequenceNumberThe EventSequenceNumber of the event as persisted in the event sequence.
correlationIdCorrelationIdThe CorrelationId for the event.
occurredDateTimeOffset?Optional occurred.
Returns
- EventContext
A new EventContext.
WithState(EventObservationState)
Creates a copy of the context object with the new desired state.
public EventContext WithState(EventObservationState desiredState)
Parameters
desiredStateEventObservationStateThe desired state.
Returns
- EventContext
A new copy with the desired state set.