Interface IReadModelPropertiesBuilder<TReadModel, TEvent, TBuilder>
- Namespace
- Cratis.Chronicle.Projections
- Assembly
- Cratis.Chronicle.dll
Defines the builder for building properties on a read model.
public interface IReadModelPropertiesBuilder<TReadModel, TEvent, TBuilder> where TBuilder : class, IReadModelPropertiesBuilder<TReadModel, TEvent, TBuilder>
Type Parameters
TReadModelRead model to build for.
TEventEvent to build for.
TBuilderType of actual builder.
Methods
AddChild<TChildModel>(Expression<Func<TReadModel, IEnumerable<TChildModel>>>, Action<IAddChildBuilder<TChildModel, TEvent>>)
Start building the add child operation to a target property holding an collection of a specific child model type.
TBuilder AddChild<TChildModel>(Expression<Func<TReadModel, IEnumerable<TChildModel>>> targetProperty, Action<IAddChildBuilder<TChildModel, TEvent>> builderCallback)
Parameters
targetPropertyExpression<Func<TReadModel, IEnumerable<TChildModel>>>The collection property that will receive the child.
builderCallbackAction<IAddChildBuilder<TChildModel, TEvent>>Builder callback for building the composite key.
Returns
- TBuilder
Builder continuation.
Type Parameters
TChildModelType of child model.
AddChild<TChildModel>(Expression<Func<TReadModel, IEnumerable<TChildModel>>>, Expression<Func<TEvent, TChildModel>>)
Start building a child operation that add a child based on a property on the event.
TBuilder AddChild<TChildModel>(Expression<Func<TReadModel, IEnumerable<TChildModel>>> targetProperty, Expression<Func<TEvent, TChildModel>> eventProperty)
Parameters
targetPropertyExpression<Func<TReadModel, IEnumerable<TChildModel>>>The collection property that will receive the child.
eventPropertyExpression<Func<TEvent, TChildModel>>Event property accessor for defining the source property.
Returns
- TBuilder
Builder continuation.
Type Parameters
TChildModelType of child model.
Add<TProperty>(Expression<Func<TReadModel, TProperty>>)
Start building the add operation to a target property on the model.
IAddBuilder<TReadModel, TEvent, TProperty, TBuilder> Add<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- IAddBuilder<TReadModel, TEvent, TProperty, TBuilder>
Builder continuation.
Type Parameters
TPropertyType of the property.
Count<TProperty>(Expression<Func<TReadModel, TProperty>>)
Start building the count operation to a target property on the model.
TBuilder Count<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- TBuilder
Builder continuation.
Type Parameters
TPropertyType of the property.
Decrement<TProperty>(Expression<Func<TReadModel, TProperty>>)
Increment the value of a property on the model.
TBuilder Decrement<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- TBuilder
Builder continuation.
Type Parameters
TPropertyType of the property.
Increment<TProperty>(Expression<Func<TReadModel, TProperty>>)
Increment the value of a property on the model.
TBuilder Increment<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- TBuilder
Builder continuation.
Type Parameters
TPropertyType of the property.
Set(PropertyPath)
Start building the set operation to a target property on the model.
ISetBuilder<TReadModel, TEvent, TBuilder> Set(PropertyPath propertyPath)
Parameters
propertyPathPropertyPathModel property path for defining the target property.
Returns
- ISetBuilder<TReadModel, TEvent, TBuilder>
The ISetBuilder<TReadModel, TEvent, TParentBuilder> to continue building on.
SetThisValue()
Start building the set operation to target the value instance itself.
ISetBuilder<TReadModel, TEvent, TBuilder> SetThisValue()
Returns
- ISetBuilder<TReadModel, TEvent, TBuilder>
The ISetBuilder<TReadModel, TEvent, TParentBuilder> to continue building on.
Set<TProperty>(Expression<Func<TReadModel, TProperty>>)
Start building the set operation to a target property on the model.
ISetBuilder<TReadModel, TEvent, TProperty, TBuilder> Set<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- ISetBuilder<TReadModel, TEvent, TProperty, TBuilder>
The ISetBuilder<TReadModel, TEvent, TProperty, TParentBuilder> to continue building on.
Type Parameters
TPropertyType of the property.
Subtract<TProperty>(Expression<Func<TReadModel, TProperty>>)
Start building the add operation to a target property on the model.
ISubtractBuilder<TReadModel, TEvent, TProperty, TBuilder> Subtract<TProperty>(Expression<Func<TReadModel, TProperty>> readModelPropertyAccessor)
Parameters
readModelPropertyAccessorExpression<Func<TReadModel, TProperty>>Model property accessor for defining the target property.
Returns
- ISubtractBuilder<TReadModel, TEvent, TProperty, TBuilder>
Builder continuation.
Type Parameters
TPropertyType of the property.
UsingCompositeKey<TKeyType>(Action<ICompositeKeyBuilder<TKeyType, TEvent>>)
Define what key to use based on a composite of expressions.
TBuilder UsingCompositeKey<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.
UsingConstantKey(string)
Define a constant value to use as the key. All events of this type will update the same read model instance.
TBuilder UsingConstantKey(string value)
Parameters
valuestringThe constant value to use as key.
Returns
- TBuilder
Builder continuation.
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.
TBuilder UsingConstantParentKey(string value)
Parameters
valuestringThe constant value to use as parent key.
Returns
- TBuilder
Builder continuation.
UsingKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>>)
Define what key to use based on a value in the EventContext.
TBuilder UsingKeyFromContext<TProperty>(Expression<Func<EventContext, TProperty>> keyAccessor)
Parameters
keyAccessorExpression<Func<EventContext, TProperty>>Accessor for the property within EventContext to use.
Returns
- TBuilder
Builder continuation.
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.
TBuilder UsingKey<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.
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.
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.
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.
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.