Class KeyBuilder<TEvent>

Namespace
Cratis.Chronicle.Keys
Assembly
Cratis.Chronicle.dll

Represents an implementation of IKeyBuilder<TEvent>.

public class KeyBuilder<TEvent> : IKeyBuilder<TEvent>

Type Parameters

TEvent

Type of event to build for.

Inheritance
KeyBuilder<TEvent>
Implements
IKeyBuilder<TEvent>
Inherited Members
Extension Methods

Constructors

KeyBuilder()

public KeyBuilder()

Methods

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

Define what key to use based on a composite of expressions.

public void UsingCompositeKey<TKeyType>(Action<ICompositeKeyBuilder<TKeyType, TEvent>> builderCallback)

Parameters

builderCallback Action<ICompositeKeyBuilder<TKeyType, TEvent>>

Builder callback for building the composite key.

Type Parameters

TKeyType

Type of key.

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

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

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

Parameters

keyAccessor Expression<Func<TEvent, EventContext>>

Accessor for the property within EventContext to use.

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

Parameters

keyAccessor Expression<Func<TEvent, TProperty>>

Accessor for the property to use.

Type Parameters

TProperty

Type of the property.