Class FromEventAttribute<TEvent>
- Assembly
- Cratis.Chronicle.dll
Attribute used at class level to indicate that properties should be set from an event by convention.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = true)]
public sealed class FromEventAttribute<TEvent> : Attribute, IProjectionAnnotation, IFromEventAttribute, IEventBoundAttribute, IKeyedAttribute
Type Parameters
TEventThe type of event to set from.
- Inheritance
-
FromEventAttribute<TEvent>
- Implements
- Inherited Members
- Extension Methods
Constructors
FromEventAttribute(string?, string?)
Attribute used at class level to indicate that properties should be set from an event by convention.
public FromEventAttribute(string? key = null, string? parentKey = null)
Parameters
keystringOptional property name on the event that identifies the read model instance. Defaults to using the event source identifier.
parentKeystringOptional property name on the event that identifies the parent read model instance for child relationships.
Properties
ConstantKey
Gets or sets a constant value to use as the key. All events of this type will update the same read model instance.
public string? ConstantKey { get; init; }
Property Value
EventType
Gets the type of event this attribute projects from.
public Type EventType { get; }
Property Value
Key
Gets the property name on the event that identifies the read model instance.
public string? Key { get; }
Property Value
ParentKey
Gets the property name on the event that identifies the parent read model instance for child relationships.
public string? ParentKey { get; }