Class ExplicitArtifacts
- Namespace
- Cratis.Chronicle.Registrations
- Assembly
- Cratis.Chronicle.dll
Represents artifacts registered explicitly with the client while it is being configured, rather than found by discovery - for every event store the client creates.
public class ExplicitArtifacts
- Inheritance
-
ExplicitArtifacts
- Inherited Members
- Extension Methods
Remarks
Reach this through ExplicitArtifacts when the registrations are known before the client connects, typically from hosting or dependency injection setup. Each event store the client creates from then on - whatever its namespace - receives them, builds them when it discovers its artifacts, and includes them in its normal registration pass and in every re-registration after a reconnect, exactly as it does its discovered artifacts.
A registration made after an event store has been created does not reach that event store. To register with an event store that already exists - connected or not - use Register<TReadModel>(Action<IProjectionBuilderFor<TReadModel>>, ProjectionId?), Register<TReadModel>() and Register(ReactorId, Action<IReactorBuilder>) on it instead; those register with Chronicle immediately when connected.
Registrations are built during discovery, so they only take effect for event stores that discover their artifacts - the default, governed by AutoDiscoverAndRegister. A projection that cannot be built is reported through Registration like a discovered one; a reactor that cannot be defined fails discovery.
Constructors
ExplicitArtifacts()
public ExplicitArtifacts()
Methods
RegisterConstraint(Type)
Registers a constraint definer by CLR type.
public ExplicitArtifacts RegisterConstraint(Type constraintType)
Parameters
constraintTypeTypeThe constraint definer type.
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterConstraint<TConstraint>()
Registers a constraint defined by Define(IConstraintBuilder).
public ExplicitArtifacts RegisterConstraint<TConstraint>()
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TConstraintThe constraint definer type.
RegisterEventSource(Type, string?)
Registers an event source by CLR type.
public ExplicitArtifacts RegisterEventSource(Type eventSourceType, string? name = null)
Parameters
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterEventSource<TSource>(string?)
Registers an event source with its declared streams and optional name.
public ExplicitArtifacts RegisterEventSource<TSource>(string? name = null)
Parameters
namestringOptional supplied event source name.
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TSourceThe event source type.
RegisterEventType(Type, Action<IEventTypeRegistrationBuilder>?)
Registers a CLR event type for every subsequently created store.
public ExplicitArtifacts RegisterEventType(Type eventType, Action<IEventTypeRegistrationBuilder>? configure = null)
Parameters
eventTypeTypeThe CLR event type.
configureAction<IEventTypeRegistrationBuilder>Optional supplied declaration facets; omitted facets inherit markers or defaults.
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterEventType<TEvent>(Action<IEventTypeRegistrationBuilder>?)
Registers an event type for every subsequently created store.
public ExplicitArtifacts RegisterEventType<TEvent>(Action<IEventTypeRegistrationBuilder>? configure = null)
Parameters
configureAction<IEventTypeRegistrationBuilder>Optional supplied declaration facets; omitted facets inherit markers or defaults.
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TEventThe event type.
RegisterMigration(Type)
Registers an event migration by CLR type.
public ExplicitArtifacts RegisterMigration(Type migrationType)
Parameters
migrationTypeTypeThe migration type.
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterMigration<TMigration>()
Registers an event migration for every subsequently created store.
public ExplicitArtifacts RegisterMigration<TMigration>()
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TMigrationThe migration type.
RegisterProjection<TReadModel>(Action<IProjectionBuilderFor<TReadModel>>, ProjectionId?)
Register a read model with a projection defined through the same builder an IProjectionFor<TReadModel> uses.
public ExplicitArtifacts RegisterProjection<TReadModel>(Action<IProjectionBuilderFor<TReadModel>> define, ProjectionId? id = null)
Parameters
defineAction<IProjectionBuilderFor<TReadModel>>Callback that defines the projection.
idProjectionIdOptional ProjectionId. Defaults to the full name of
TReadModel.
Returns
- ExplicitArtifacts
The same ExplicitArtifacts for continuation.
Type Parameters
TReadModelType of read model the projection maintains.
Remarks
This behaves as Register<TReadModel>(Action<IProjectionBuilderFor<TReadModel>>, ProjectionId?) does, for every event store the client creates.
RegisterReactor(ReactorId, Action<IReactorBuilder>)
Register a reactor declared fluently.
public ExplicitArtifacts RegisterReactor(ReactorId id, Action<IReactorBuilder> define)
Parameters
idReactorIdThe stable reactor identifier.
defineAction<IReactorBuilder>Declares the reactor's handlers on an IReactorBuilder.
Returns
- ExplicitArtifacts
The same ExplicitArtifacts for continuation.
Remarks
This behaves as Register(ReactorId, Action<IReactorBuilder>) does, for every event store the client creates. The definition callback runs once per event store, the first time it discovers its artifacts - so an all-events subscription covers the event types known at that point.
RegisterReactor(Type, ReactorId?)
Registers an instance-method reactor by CLR type.
public ExplicitArtifacts RegisterReactor(Type reactorType, ReactorId? id = null)
Parameters
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterReactor<TReactor>(ReactorId?)
Registers an instance-method reactor without requiring IReactor.
public ExplicitArtifacts RegisterReactor<TReactor>(ReactorId? id = null)
Parameters
idReactorIdOptional supplied identifier.
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TReactorThe reactor type.
RegisterReadModel<TReadModel>()
Register a read model whose projection is declared by its model-bound attributes.
public ExplicitArtifacts RegisterReadModel<TReadModel>()
Returns
- ExplicitArtifacts
The same ExplicitArtifacts for continuation.
Type Parameters
TReadModelType of read model carrying the model-bound projection attributes.
Remarks
This behaves as Register<TReadModel>() does, for every event store the client creates. A read model that discovery also finds is registered once.
RegisterReducer(Type, ReducerId?)
Registers a reducer by CLR type and inferred read model.
public ExplicitArtifacts RegisterReducer(Type reducerType, ReducerId? id = null)
Parameters
Returns
- ExplicitArtifacts
The same options object for continuation.
RegisterReducer<TReducer>(ReducerId?)
Registers a reducer whose single read model is inferred from instance methods.
public ExplicitArtifacts RegisterReducer<TReducer>(ReducerId? id = null)
Parameters
idReducerIdOptional supplied identifier.
Returns
- ExplicitArtifacts
The same options object for continuation.
Type Parameters
TReducerThe reducer type.