Table of Contents

Class KeyAndParentKeyBuilder<TEvent, TBuilder>

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

Represents a builder for both key and parent key.

public class KeyAndParentKeyBuilder<TEvent, TBuilder> : KeyBuilder<TEvent, TBuilder>, IKeyBuilder<TEvent, TBuilder>, IParentKeyBuilder<TEvent, TBuilder> where TBuilder : class

Type Parameters

TEvent

Event to build for.

TBuilder

Type of actual builder.

Inheritance
KeyBuilder<TEvent, TBuilder>
KeyAndParentKeyBuilder<TEvent, TBuilder>
Implements
IKeyBuilder<TEvent, TBuilder>
IParentKeyBuilder<TEvent, TBuilder>
Derived
Inherited Members

Constructors

KeyAndParentKeyBuilder(INamingPolicy)

Represents a builder for both key and parent key.

public KeyAndParentKeyBuilder(INamingPolicy namingPolicy)

Parameters

namingPolicy INamingPolicy

The INamingPolicy to use for property names.

Fields

_parentKeyExpression

protected PropertyExpression _parentKeyExpression

Field Value

PropertyExpression

Methods

UsingConstantParentKey(string)

Define a constant value to use as the parent key. All events of this type will update the same parent read model instance.

public TBuilder UsingConstantParentKey(string value)

Parameters

value string

The constant value to use as parent key.

Returns

TBuilder

Builder continuation.

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 TBuilder UsingParentCompositeKey<TKeyType>(Action<ICompositeKeyBuilder<TKeyType, TEvent>> builderCallback)

Parameters

builderCallback Action<ICompositeKeyBuilder<TKeyType, TEvent>>

Builder callback for building the composite key.

Returns

TBuilder

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 TBuilder UsingParentKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<EventContext, TProperty>>

Accessor for the property to use.

Returns

TBuilder

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 TBuilder UsingParentKey<TProperty>(Expression<Func<TEvent, TProperty>> keyAccessor)

Parameters

keyAccessor Expression<Func<TEvent, TProperty>>

Accessor for the property to use.

Returns

TBuilder

Builder continuation.

Type Parameters

TProperty

Type of the property.