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
TEventType 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
builderCallbackAction<ICompositeKeyBuilder<TKeyType, TEvent>>Builder callback for building the composite key.
Type Parameters
TKeyTypeType 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
keyAccessorExpression<Func<TEvent, EventContext>>Accessor for the property within EventContext to use.
Type Parameters
TPropertyType 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
keyAccessorExpression<Func<TEvent, TProperty>>Accessor for the property to use.
Type Parameters
TPropertyType of the property.