Class GlobalForAttribute<TIdentity>

Namespace
Cratis.Chronicle.Projections.ModelBound
Assembly
Cratis.Chronicle.dll

Attribute used to declare event handlers once for every variant of TIdentity, rather than repeating them on each VariantOfAttribute<TIdentity> type.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct, AllowMultiple = false)]
public sealed class GlobalForAttribute<TIdentity> : Attribute, IProjectionAnnotation

Type Parameters

TIdentity

The type that anchors the logical identity the variants are grouped under.

Inheritance
GlobalForAttribute<TIdentity>
Implements
Inherited Members
Extension Methods

Remarks

The decorated type carries the shared mappings as ordinary model-bound members - for example a property with SetFromAttribute<TEvent>. Every mapping is merged into every variant of TIdentity, and every variant must have the members the mappings target; one that does not is a declaration error rather than a silently skipped mapping.

A shared handler can only ever update an already-active variant. It is merged as an update-only, self-referential join, so an event handled globally never creates a variant and can never resurrect the entity into a variant it has since left.

Constructors

GlobalForAttribute()

public GlobalForAttribute()

Properties

Identity

Gets the type that anchors the logical identity the variants are grouped under.

public Type Identity { get; }

Property Value

Type