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
TEventThe 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
keystringOptional property name on the event that identifies the child. Defaults to WellKnownExpressions.EventSourceId.
identifiedBystringOptional 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.
parentKeystringOptional 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
IdentifiedBy
Gets the optional name of the property to identify children by.
public string? IdentifiedBy { get; }
Property Value
Key
Gets the name of the property to use as key.
public string Key { get; }
Property Value
ParentKey
Gets the optional name of the property on the parent to use as key.
public string? ParentKey { get; }