Interface IAddChildBuilder<TChildModel, TEvent>
- Namespace
- Cratis.Chronicle.Projections
- Assembly
- Cratis.Chronicle.dll
Defines a builder for building an add child operation, typically used in to a from expression.
public interface IAddChildBuilder<TChildModel, TEvent>
Type Parameters
TChildModel
Child model type.
TEvent
Type of event.
Methods
FromObject(Expression<Func<TEvent, TChildModel>>)
Describe an adding of a child from an object already on the event.
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.
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.
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.
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 model to work with.
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 model to work with.
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 model to work with.
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.