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
eventSequenceIEventSequenceThe IEventSequence to append to.
eventSourceTypeThe type of the IEventSource to append through.
eventSourceIdEventSourceIdThe EventSourceId of the event source instance.
eventobjectThe event to append.
eventStreamstringOptional name of a stream declared by the event source.
eventStreamIdEventStreamIdOptional EventStreamId within the stream. The format is left to the caller.
correlationIdCorrelationIdOptional CorrelationId of the event.
tagsIEnumerable<string>Optional tags to associate with the event.
concurrencyScopeConcurrencyScopeOptional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.
occurredDateTimeOffset?Optional time the event occurred.
subjectSubjectOptional 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
eventSequenceIEventSequenceThe IEventSequence to append to.
eventSourceTypeThe type of the IEventSource to append through.
eventSourceIdEventSourceIdThe EventSourceId of the event source instance.
eventsIEnumerable<object>The events to append.
eventStreamstringOptional name of a stream declared by the event source.
eventStreamIdEventStreamIdOptional EventStreamId within the stream. The format is left to the caller.
correlationIdCorrelationIdOptional CorrelationId of the events.
tagsIEnumerable<string>Optional tags to associate with the events.
concurrencyScopeConcurrencyScopeOptional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.
occurredDateTimeOffset?Optional time the events occurred.
subjectSubjectOptional 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
eventSequenceIEventSequenceThe IEventSequence to append to.
eventSourceIdEventSourceIdThe EventSourceId of the event source instance.
eventsIEnumerable<object>The events to append.
eventStreamstringOptional name of a stream declared by the event source.
eventStreamIdEventStreamIdOptional EventStreamId within the stream. The format is left to the caller.
correlationIdCorrelationIdOptional CorrelationId of the events.
tagsIEnumerable<string>Optional tags to associate with the events.
concurrencyScopeConcurrencyScopeOptional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.
occurredDateTimeOffset?Optional time the events occurred.
subjectSubjectOptional Subject of the events.
Returns
- Task<AppendManyResult>
AppendManyResult with details about whether or not it succeeded and more.
Type Parameters
TSourceThe 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
eventSequenceIEventSequenceThe IEventSequence that prepared the content.
eventSourceIdEventSourceIdThe EventSourceId of the event source instance.
preparedEventPreparedEventThe content prepared by the sequence.
eventStreamstringOptional name of a stream declared by the event source.
eventStreamIdEventStreamIdOptional EventStreamId within the stream. The format is left to the caller.
correlationIdCorrelationIdOptional CorrelationId of the event.
tagsIEnumerable<string>Optional tags to associate with the event.
concurrencyScopeConcurrencyScopeOptional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.
occurredDateTimeOffset?Optional time the event occurred.
subjectSubjectOptional subject overriding the prepared event's subject.
Returns
- Task<AppendResult>
AppendResult with details about whether or not it succeeded and more.
Type Parameters
TSourceThe 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
eventSequenceIEventSequenceThe IEventSequence to append to.
eventSourceIdEventSourceIdThe EventSourceId of the event source instance.
eventobjectThe event to append.
eventStreamstringOptional name of a stream declared by the event source.
eventStreamIdEventStreamIdOptional EventStreamId within the stream. The format is left to the caller.
correlationIdCorrelationIdOptional CorrelationId of the event.
tagsIEnumerable<string>Optional tags to associate with the event.
concurrencyScopeConcurrencyScopeOptional ConcurrencyScope. When not set it is narrowed to the dimensions the definition declares.
occurredDateTimeOffset?Optional time the event occurred.
subjectSubjectOptional Subject of the event.
Returns
- Task<AppendResult>
AppendResult with details about whether or not it succeeded and more.
Type Parameters
TSourceThe IEventSource to append through.
Exceptions
- UnknownEventSource
The type is not a discovered event source.
- EventStreamDoesNotBelongToEventSource
The stream is not declared by the event source.