Class EntersOnAttribute<TEvent>
- Assembly
- Cratis.Chronicle.dll
Attribute used on a type decorated with VariantOfAttribute<TIdentity> to declare the event that activates (creates) this variant.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true)]
public sealed class EntersOnAttribute<TEvent> : Attribute, IProjectionAnnotation
Type Parameters
TEventThe type of event that activates this variant.
- Inheritance
-
EntersOnAttribute<TEvent>
- Implements
- Inherited Members
- Extension Methods
Remarks
Only the event(s) declared with this attribute may create or resurrect the variant. Every other event handled by the variant - whether declared directly on it or shared through a global handler - only updates an already-active instance of this variant and can never create one, so it can never resurrect the entity into a variant it has since left.
Constructors
EntersOnAttribute(string?)
Attribute used on a type decorated with VariantOfAttribute<TIdentity> to declare the event that activates (creates) this variant.
public EntersOnAttribute(string? key = null)
Parameters
keystringOptional property name on the event that identifies the read model instance. Defaults to using the event source identifier.
Remarks
Only the event(s) declared with this attribute may create or resurrect the variant. Every other event handled by the variant - whether declared directly on it or shared through a global handler - only updates an already-active instance of this variant and can never create one, so it can never resurrect the entity into a variant it has since left.
Properties
EventType
Gets the type of event that activates this variant.
public Type EventType { get; }
Property Value
Key
Gets the property name on the event that identifies the read model instance.
public string? Key { get; }