Interface IProjectionBuilderFor<TReadModel>
- Namespace
- Cratis.Chronicle.Projections
- Assembly
- Cratis.Chronicle.dll
Defines the builder for building out a IProjectionFor<TReadModel>.
public interface IProjectionBuilderFor<TReadModel> : IProjectionBuilder<TReadModel, IProjectionBuilderFor<TReadModel>>
Type Parameters
TReadModelType of read model.
- Inherited Members
- Extension Methods
Methods
ContainerName(string)
Names the model container - typically used by storage as name of storage unit (collection, table, etc.).
IProjectionBuilderFor<TReadModel> ContainerName(string containerName)
Parameters
containerNamestringContainer name of the read model.
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
Remarks
Overrides the container name the naming policy would otherwise give the read model. The identifier of the read model is not affected. Every projection of the same read model must agree on the container name.
EntersOn<TEvent>()
Declares the event that activates this variant.
IProjectionBuilderFor<TReadModel> EntersOn<TEvent>()
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
Type Parameters
TEventType of event that activates this variant.
Remarks
Only for a projection that also declares VariantOf<TIdentity>(Expression<Func<TReadModel, object?>>). The event keeps its ordinary
create-or-update behavior; mapping its properties is still done with the usual
From call.
FromEventSequence(EventSequenceId)
Specifies the EventSequenceId to use as source.
IProjectionBuilderFor<TReadModel> FromEventSequence(EventSequenceId eventSequenceId)
Parameters
eventSequenceIdEventSequenceIdEventSequenceId to use.
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
NotRewindable()
Set the projection to not be rewindable - its a moving forward only projection.
IProjectionBuilderFor<TReadModel> NotRewindable()
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
Passive()
Set the projection not be active, meaning that it won't actively observe.
IProjectionBuilderFor<TReadModel> Passive()
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
VariantOf<TIdentity>(Expression<Func<TReadModel, object?>>)
Declares this projection as one of several mutually exclusive representations of the same logical entity.
IProjectionBuilderFor<TReadModel> VariantOf<TIdentity>(Expression<Func<TReadModel, object?>> keyAccessor)
Parameters
keyAccessorExpression<Func<TReadModel, object>>Accessor for this read model's own key, used to correlate an event back to an already-active instance.
Returns
- IProjectionBuilderFor<TReadModel>
Builder continuation.
Type Parameters
TIdentityThe type anchoring the logical identity the variants share. It needs no read model and no common base type with the variants.
Remarks
Every projection declaring the same TIdentity forms a group. Entering one variant
removes the entity from every other variant in that group. Only the events named with
EntersOn<TEvent>() may create this variant; every other event it projects from becomes an
update-only mapping that can bring an active instance up to date but never create or resurrect one.