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
TEventEvent to build for.
TBuilderType 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
namingPolicyINamingPolicyThe INamingPolicy to use for property names.
Fields
_parentKeyExpression
protected PropertyExpression _parentKeyExpression
Field Value
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
valuestringThe 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
builderCallbackAction<ICompositeKeyBuilder<TKeyType, TEvent>>Builder callback for building the composite key.
Returns
- TBuilder
Builder continuation.
Type Parameters
TKeyTypeType 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
keyAccessorExpression<Func<EventContext, TProperty>>Accessor for the property to use.
Returns
- TBuilder
Builder continuation.
Type Parameters
TPropertyType 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
keyAccessorExpression<Func<TEvent, TProperty>>Accessor for the property to use.
Returns
- TBuilder
Builder continuation.
Type Parameters
TPropertyType of the property.