Table of Contents

Class ChildrenFromAttribute<TEvent>

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

Attribute used to indicate that a property represents a collection of children from an event.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Parameter, AllowMultiple = true)]
public sealed class ChildrenFromAttribute<TEvent> : Attribute, IProjectionAnnotation, IChildrenFromAttribute, IKeyedAttribute

Type Parameters

TEvent

The type of event that adds children.

Inheritance
ChildrenFromAttribute<TEvent>
Implements
Inherited Members

Remarks

Initializes a new instance of ChildrenFromAttribute<TEvent>.

Constructors

ChildrenFromAttribute(string?, string?, string?)

Attribute used to indicate that a property represents a collection of children from an event.

public ChildrenFromAttribute(string? key = null, string? identifiedBy = null, string? parentKey = null)

Parameters

key string

Optional property name on the event that identifies the child. Defaults to WellKnownExpressions.EventSourceId.

identifiedBy string

Optional property name on the child model that identifies it. If not specified, will look for [Key] attribute, then an Id property by convention, finally defaulting to WellKnownExpressions.EventSourceId.

parentKey string

Optional property name that identifies the parent. Defaults to WellKnownExpressions.EventSourceId.

Remarks

Initializes a new instance of ChildrenFromAttribute<TEvent>.

Properties

EventType

Gets the type of event to project from.

public Type EventType { get; }

Property Value

Type

IdentifiedBy

Gets the optional name of the property to identify children by.

public string? IdentifiedBy { get; }

Property Value

string

Key

Gets the name of the property to use as key.

public string Key { get; }

Property Value

string

ParentKey

Gets the optional name of the property on the parent to use as key.

public string? ParentKey { get; }

Property Value

string