Skip to content

Event sources in the .NET client

This page covers the .NET client’s API for event source definitions. The guides, the scenarios and the explanation of how they work are in Event sources and streams. This page lists the client types and where each is explained. An event source is optional: the existing append APIs remain valid and append events without a definition.

Type Purpose Explained in
IEventSource Marker interface. A class that implements it is a definition Define an event source
[EventSource] Names the definition and sets its description and default Concurrency Define an event source
[EventStream] Declares a stream, with its own description and Concurrency. Repeat it for each stream Define an event source
ConcurrencyDimensions Flags that choose which values take part in an append’s concurrency check Concurrency
Append<TSource>, AppendMany<TSource>, AppendPrepared<TSource> Extension methods on IEventSequence Append through a definition
EventForEventSourceId.EventSource and .EventStream Route one event of a multi-source batch through a definition Append through a definition
ConcurrencyScopeBuilder.ForEventSource<TSource> Builds an explicit scope from a definition’s names Concurrency
[FromEventSource<TSource>] Filters a reactor or reducer to one stream Filter observers
IEventStore.EventSources and IEventSources All, GetFor(Type) and GetFor(string) return the discovered EventSourceDefinition records Define an event source
IClientArtifactsProvider.EventSources The types the client treats as definitions How it works
Exception Thrown when
DuplicateEventSourceName Two definitions share a name
DuplicateEventStreamName A definition declares a stream twice
UnknownEventSource A type or name is not a discovered definition
EventStreamDoesNotBelongToEventSource A stream name is not declared by the definition
EventRoutingContradictsEventSource An explicit event source type or stream type contradicts the definition
IncompatibleConcurrencyScopesForEventSource A batch needs different guards for one event source id and the kernel does not advertise support for concurrency-scope conjunctions. See Concurrency
EventSourcesNotSupported An IEventStore or IEventSequence implementation does not support event sources, such as a custom test double

With explicit artifact registration you nominate the definitions in the composition root. A nominated event source keeps its declared streams and metadata, and an explicit name changes the registered identity only.