Class ClearWithAttribute<TEvent>
- Assembly
- Cratis.Chronicle.dll
Attribute used to indicate which event clears (sets to null) a read model member.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = true)]
public sealed class ClearWithAttribute<TEvent> : Attribute, IClearWithAttribute, IProjectionAnnotation
Type Parameters
TEventThe type of event that clears the member.
- Inheritance
-
ClearWithAttribute<TEvent>
- Implements
- Inherited Members
- Extension Methods
Remarks
On a scalar property or record parameter this clears that member: the projection writes null to it every time the event is observed, replay included. The member has to be able to hold null - a non-nullable member is rejected when the projection is built, because writing its type default would be a different fact than "no value" and is what SetValueAttribute<TEvent> is for.
On a NestedAttribute single-object property, and applied to the nested type itself, this clears the whole nested object back to null.
Constructors
ClearWithAttribute()
public ClearWithAttribute()
Properties
EventType
Gets the type of event that clears the nested object.
public Type EventType { get; }