Class FromEventAttribute<TEvent>
- Namespace
- Cratis.Chronicle.Projections.ModelBound
- 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
Type Parameters
TEventThe type of event to set from.
- Inheritance
-
FromEventAttribute<TEvent>
- Implements
- Inherited Members
Constructors
FromEventAttribute(string?)
Attribute used at class level to indicate that properties should be set from an event by convention.
public FromEventAttribute(string? key = null)
Parameters
keystringOptional property name on the event that identifies the read model instance. Defaults to using the event source identifier.
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; }