Class EventSourceTypeAttribute
- Namespace
- Cratis.Chronicle.Events
- Assembly
- Cratis.Chronicle.dll
Attribute to specify the EventSourceType for a command or observer.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
public sealed class EventSourceTypeAttribute : Attribute
- Inheritance
-
EventSourceTypeAttribute
- Inherited Members
- Extension Methods
Remarks
When applied to an observer (reactor or reducer), it filters observed events to only
those originating from the given event source type. When applied to a command, setting
concurrency to true includes this value in the concurrency
scope when appending events.
A projection is not one of them. It observes every event of the types its definition declares, and cannot filter on event metadata at all - there is no field for a filter anywhere in a projection's definition, so no client can express one and no kernel could honour it. Narrow a projection by the event types it declares, or pair it with a reactor or reducer that owns the filtered subset. See Documentation/projections/filtering.
Neither is an event type. An append resolves its EventSourceType from the arguments it is given, never from the CLR type of the event being appended, so the attribute placed on an event type is read by nothing and reaches no appended event's context. Declare it on the command that appends the event, or on the reactor or reducer that observes it.
Constructors
EventSourceTypeAttribute(string, bool)
Attribute to specify the EventSourceType for a command or observer.
public EventSourceTypeAttribute(string value, bool concurrency = false)
Parameters
valuestringThe EventSourceType value.
concurrencyboolWhether to include this metadata in the concurrency scope when appending events. Default is false.
Remarks
When applied to an observer (reactor or reducer), it filters observed events to only
those originating from the given event source type. When applied to a command, setting
concurrency to true includes this value in the concurrency
scope when appending events.
A projection is not one of them. It observes every event of the types its definition declares, and cannot filter on event metadata at all - there is no field for a filter anywhere in a projection's definition, so no client can express one and no kernel could honour it. Narrow a projection by the event types it declares, or pair it with a reactor or reducer that owns the filtered subset. See Documentation/projections/filtering.
Neither is an event type. An append resolves its EventSourceType from the arguments it is given, never from the CLR type of the event being appended, so the attribute placed on an event type is read by nothing and reaches no appended event's context. Declare it on the command that appends the event, or on the reactor or reducer that observes it.
Properties
Concurrency
Gets a value indicating whether this metadata should be included in the concurrency scope.
public bool Concurrency { get; }
Property Value
EventSourceType
Gets the EventSourceType.
public EventSourceType EventSourceType { get; }