Class SetValueAttribute<TEvent>
- Assembly
- Cratis.Chronicle.dll
Attribute used to indicate that a property should be set to a constant value when an event of the specified type occurs.
[AttributeUsage(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = true)]
public sealed class SetValueAttribute<TEvent> : Attribute, IProjectionAnnotation, ISetValueAttribute, IEventBoundAttribute
Type Parameters
TEventThe type of event that triggers the value assignment.
- Inheritance
-
SetValueAttribute<TEvent>
- Implements
- Inherited Members
- Extension Methods
Remarks
The parameter is nullable so a clear can be written as a plain null. A non-nullable parameter forced every author of this declaration through the null-forgiving operator to get past the nullable analysis.
Constructors
SetValueAttribute(object?)
Attribute used to indicate that a property should be set to a constant value when an event of the specified type occurs.
public SetValueAttribute(object? value)
Parameters
valueobjectThe constant value to set. Must be a compile-time constant such as a string, number, boolean, or enum value. Pass null to clear the member back to no value - the same declaration as ClearWithAttribute<TEvent> on the member, which reads better for that intent.
Remarks
The parameter is nullable so a clear can be written as a plain null. A non-nullable parameter forced every author of this declaration through the null-forgiving operator to get past the nullable analysis.
Properties
EventType
Gets the type of event this attribute is bound to.
public Type EventType { get; }
Property Value
Value
Gets the constant value to set, or null to clear the member back to no value.
public object? Value { get; }