Class EventSequenceEventSourceExtensions

Namespace
Cratis.Chronicle.EventSequences
Assembly
Cratis.Chronicle.dll

Extension methods for appending to an IEventSequence through a registered event source.

public static class EventSequenceEventSourceExtensions
Inheritance
EventSequenceEventSourceExtensions
Inherited Members

Remarks

These are extension methods rather than overloads on IEventSequence so that existing callers and test doubles of the interface keep resolving to the same members.

Methods

Append(IEventSequence, Type, EventSourceId, object, string?, EventStreamId?, CorrelationId?, IEnumerable<string>?, ConcurrencyScope?, DateTimeOffset?, Subject?)

Appends an event through a registered event source definition.

public static Task<AppendResult> Append(this IEventSequence eventSequence, Type eventSource, EventSourceId eventSourceId, object @event, string? eventStream = null, EventStreamId? eventStreamId = null, CorrelationId? correlationId = null, IEnumerable<string>? tags = null, ConcurrencyScope? concurrencyScope = null, DateTimeOffset? occurred = null, Subject? subject = null)

Parameters

eventSequence IEventSequence

The IEventSequence to append to.

eventSource Type

The type of the IEventSource to append through.

eventSourceId EventSourceId

The EventSourceId of the event source instance.

event object

The event to append.

eventStream string

Optional name of a stream declared by the event source.

eventStreamId EventStreamId

Optional EventStreamId within the stream. The format is left to the caller.

correlationId CorrelationId

Optional CorrelationId of the event.

tags IEnumerable<string>

Optional tags to associate with the event.

concurrencyScope ConcurrencyScope

Optional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.

occurred DateTimeOffset?

Optional time the event occurred.

subject Subject

Optional Subject of the event.

Returns

Task<AppendResult>

AppendResult with details about whether or not it succeeded and more.

Exceptions

UnknownEventSource

The type is not a discovered event source.

EventStreamDoesNotBelongToEventSource

The stream is not declared by the event source.

AppendMany(IEventSequence, Type, EventSourceId, IEnumerable<object>, string?, EventStreamId?, CorrelationId?, IEnumerable<string>?, ConcurrencyScope?, DateTimeOffset?, Subject?)

Appends several events through a registered event source definition.

public static Task<AppendManyResult> AppendMany(this IEventSequence eventSequence, Type eventSource, EventSourceId eventSourceId, IEnumerable<object> events, string? eventStream = null, EventStreamId? eventStreamId = null, CorrelationId? correlationId = null, IEnumerable<string>? tags = null, ConcurrencyScope? concurrencyScope = null, DateTimeOffset? occurred = null, Subject? subject = null)

Parameters

eventSequence IEventSequence

The IEventSequence to append to.

eventSource Type

The type of the IEventSource to append through.

eventSourceId EventSourceId

The EventSourceId of the event source instance.

events IEnumerable<object>

The events to append.

eventStream string

Optional name of a stream declared by the event source.

eventStreamId EventStreamId

Optional EventStreamId within the stream. The format is left to the caller.

correlationId CorrelationId

Optional CorrelationId of the events.

tags IEnumerable<string>

Optional tags to associate with the events.

concurrencyScope ConcurrencyScope

Optional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.

occurred DateTimeOffset?

Optional time the events occurred.

subject Subject

Optional Subject of the events.

Returns

Task<AppendManyResult>

AppendManyResult with details about whether or not it succeeded and more.

Exceptions

UnknownEventSource

The type is not a discovered event source.

EventStreamDoesNotBelongToEventSource

The stream is not declared by the event source.

AppendMany<TSource>(IEventSequence, EventSourceId, IEnumerable<object>, string?, EventStreamId?, CorrelationId?, IEnumerable<string>?, ConcurrencyScope?, DateTimeOffset?, Subject?)

Appends several events through a registered event source definition.

public static Task<AppendManyResult> AppendMany<TSource>(this IEventSequence eventSequence, EventSourceId eventSourceId, IEnumerable<object> events, string? eventStream = null, EventStreamId? eventStreamId = null, CorrelationId? correlationId = null, IEnumerable<string>? tags = null, ConcurrencyScope? concurrencyScope = null, DateTimeOffset? occurred = null, Subject? subject = null) where TSource : IEventSource

Parameters

eventSequence IEventSequence

The IEventSequence to append to.

eventSourceId EventSourceId

The EventSourceId of the event source instance.

events IEnumerable<object>

The events to append.

eventStream string

Optional name of a stream declared by the event source.

eventStreamId EventStreamId

Optional EventStreamId within the stream. The format is left to the caller.

correlationId CorrelationId

Optional CorrelationId of the events.

tags IEnumerable<string>

Optional tags to associate with the events.

concurrencyScope ConcurrencyScope

Optional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.

occurred DateTimeOffset?

Optional time the events occurred.

subject Subject

Optional Subject of the events.

Returns

Task<AppendManyResult>

AppendManyResult with details about whether or not it succeeded and more.

Type Parameters

TSource

The IEventSource to append through.

Exceptions

UnknownEventSource

The type is not a discovered event source.

EventStreamDoesNotBelongToEventSource

The stream is not declared by the event source.

AppendPrepared<TSource>(IEventSequence, EventSourceId, PreparedEvent, string?, EventStreamId?, CorrelationId?, IEnumerable<string>?, ConcurrencyScope?, DateTimeOffset?, Subject?)

Appends prepared content through a registered event source definition without serializing the event or running providers again.

public static Task<AppendResult> AppendPrepared<TSource>(this IEventSequence eventSequence, EventSourceId eventSourceId, PreparedEvent preparedEvent, string? eventStream = null, EventStreamId? eventStreamId = null, CorrelationId? correlationId = null, IEnumerable<string>? tags = null, ConcurrencyScope? concurrencyScope = null, DateTimeOffset? occurred = null, Subject? subject = null) where TSource : IEventSource

Parameters

eventSequence IEventSequence

The IEventSequence that prepared the content.

eventSourceId EventSourceId

The EventSourceId of the event source instance.

preparedEvent PreparedEvent

The content prepared by the sequence.

eventStream string

Optional name of a stream declared by the event source.

eventStreamId EventStreamId

Optional EventStreamId within the stream. The format is left to the caller.

correlationId CorrelationId

Optional CorrelationId of the event.

tags IEnumerable<string>

Optional tags to associate with the event.

concurrencyScope ConcurrencyScope

Optional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.

occurred DateTimeOffset?

Optional time the event occurred.

subject Subject

Optional subject overriding the prepared event's subject.

Returns

Task<AppendResult>

AppendResult with details about whether or not it succeeded and more.

Type Parameters

TSource

The IEventSource to append through.

Exceptions

UnknownEventSource

The type is not a discovered event source.

EventStreamDoesNotBelongToEventSource

The stream is not declared by the event source.

PreparedEventBelongsToAnotherSequence

The content belongs to another sequence instance.

Append<TSource>(IEventSequence, EventSourceId, object, string?, EventStreamId?, CorrelationId?, IEnumerable<string>?, ConcurrencyScope?, DateTimeOffset?, Subject?)

Appends an event through a registered event source definition.

public static Task<AppendResult> Append<TSource>(this IEventSequence eventSequence, EventSourceId eventSourceId, object @event, string? eventStream = null, EventStreamId? eventStreamId = null, CorrelationId? correlationId = null, IEnumerable<string>? tags = null, ConcurrencyScope? concurrencyScope = null, DateTimeOffset? occurred = null, Subject? subject = null) where TSource : IEventSource

Parameters

eventSequence IEventSequence

The IEventSequence to append to.

eventSourceId EventSourceId

The EventSourceId of the event source instance.

event object

The event to append.

eventStream string

Optional name of a stream declared by the event source.

eventStreamId EventStreamId

Optional EventStreamId within the stream. The format is left to the caller.

correlationId CorrelationId

Optional CorrelationId of the event.

tags IEnumerable<string>

Optional tags to associate with the event.

concurrencyScope ConcurrencyScope

Optional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.

occurred DateTimeOffset?

Optional time the event occurred.

subject Subject

Optional Subject of the event.

Returns

Task<AppendResult>

AppendResult with details about whether or not it succeeded and more.

Type Parameters

TSource

The IEventSource to append through.

Exceptions

UnknownEventSource

The type is not a discovered event source.

EventStreamDoesNotBelongToEventSource

The stream is not declared by the event source.