Table of Contents

Class AddChildBuilder<TParentReadModel, TChildModel, TEvent>

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

Represents an implementation of IAddChildBuilder<TChildModel, TEvent>.

public class AddChildBuilder<TParentReadModel, TChildModel, TEvent> : IAddChildBuilder<TChildModel, TEvent>

Type Parameters

TParentReadModel

Parent read model type.

TChildModel

Child read model type.

TEvent

Type of the event.

Inheritance
AddChildBuilder<TParentReadModel, TChildModel, TEvent>
Implements
IAddChildBuilder<TChildModel, TEvent>
Inherited Members

Constructors

AddChildBuilder(IChildrenBuilder<TParentReadModel, TChildModel>, IFromBuilder<TChildModel, TEvent>, INamingPolicy)

Represents an implementation of IAddChildBuilder<TChildModel, TEvent>.

public AddChildBuilder(IChildrenBuilder<TParentReadModel, TChildModel> childrenBuilder, IFromBuilder<TChildModel, TEvent> fromBuilder, INamingPolicy namingPolicy)

Parameters

childrenBuilder IChildrenBuilder<TParentReadModel, TChildModel>

The children builder to use internally.

fromBuilder IFromBuilder<TChildModel, TEvent>

The IFromBuilder<TReadModel, TEvent> to build the internals of the child relationship.

namingPolicy INamingPolicy

The INamingPolicy to use for converting names during serialization.

Methods

FromObject(Expression<Func<TEvent, TChildModel>>)

Describe an adding of a child from an object already on the event.

public IAddChildBuilder<TChildModel, TEvent> FromObject(Expression<Func<TEvent, TChildModel>> propertyWithChild)

Parameters

propertyWithChild Expression<Func<TEvent, TChildModel>>

The property that holds object on the event.

Returns

IAddChildBuilder<TChildModel, TEvent>

Parent builder for continuation.

IdentifiedBy<TProperty>(Expression<Func<TChildModel, TProperty>>)

Sets the property that identifies the child model in the collection within the parent.

public IAddChildBuilder<TChildModel, TEvent> IdentifiedBy<TProperty>(Expression<Func<TChildModel, TProperty>> propertyExpression)

Parameters

propertyExpression Expression<Func<TChildModel, TProperty>>

The expression that represents the property used to identify.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TProperty

Type of property.

UsingKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>>)

Define what key to use based on a value in the EventContext.

public IAddChildBuilder<TChildModel, TEvent> UsingKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<EventContext, TProperty>>

Accessor for the property within EventContext to use.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TProperty

Type of the property.

UsingKey<TProperty>(Expression<Func<TEvent, TProperty>>)

Define what key to use. This is optional, if not set - it will default to using the event source identifier on the event.

public IAddChildBuilder<TChildModel, TEvent> UsingKey<TProperty>(Expression<Func<TEvent, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<TEvent, TProperty>>

Accessor for the property to use.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TProperty

Type of the property.

UsingParentCompositeKey<TKeyType>(Action<ICompositeKeyBuilder<TKeyType, TEvent>>)

Define what composite key based on properties on the event represents the parent key. This is typically used in child relationships to identify the parent read model to work with.

public IAddChildBuilder<TChildModel, TEvent> UsingParentCompositeKey<TKeyType>(Action<ICompositeKeyBuilder<TKeyType, TEvent>> builderCallback)

Parameters

builderCallback Action<ICompositeKeyBuilder<TKeyType, TEvent>>

Builder callback for building the composite key.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TKeyType

Type of key.

UsingParentKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>>)

Define what property on the event represents the parent key based on a property in the EventContext. This is typically used in child relationships to identify the parent read model to work with.

public IAddChildBuilder<TChildModel, TEvent> UsingParentKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<EventContext, TProperty>>

Accessor for the property to use.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TProperty

Type of the property.

UsingParentKey<TProperty>(Expression<Func<TEvent, TProperty>>)

Define what property on the event represents the parent key. This is typically used in child relationships to identify the parent read model to work with.

public IAddChildBuilder<TChildModel, TEvent> UsingParentKey<TProperty>(Expression<Func<TEvent, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<TEvent, TProperty>>

Accessor for the property to use.

Returns

IAddChildBuilder<TChildModel, TEvent>

Builder continuation.

Type Parameters

TProperty

Type of the property.