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

constraintType Type

The 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

TConstraint

The constraint definer type.

RegisterEventSource(Type, string?)

Registers an event source by CLR type.

public ExplicitArtifacts RegisterEventSource(Type eventSourceType, string? name = null)

Parameters

eventSourceType Type

The event source type.

name string

Optional supplied event source name.

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

name string

Optional supplied event source name.

Returns

ExplicitArtifacts

The same options object for continuation.

Type Parameters

TSource

The 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

eventType Type

The CLR event type.

configure Action<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

configure Action<IEventTypeRegistrationBuilder>

Optional supplied declaration facets; omitted facets inherit markers or defaults.

Returns

ExplicitArtifacts

The same options object for continuation.

Type Parameters

TEvent

The event type.

RegisterMigration(Type)

Registers an event migration by CLR type.

public ExplicitArtifacts RegisterMigration(Type migrationType)

Parameters

migrationType Type

The 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

TMigration

The 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

define Action<IProjectionBuilderFor<TReadModel>>

Callback that defines the projection.

id ProjectionId

Optional ProjectionId. Defaults to the full name of TReadModel.

Returns

ExplicitArtifacts

The same ExplicitArtifacts for continuation.

Type Parameters

TReadModel

Type 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

id ReactorId

The stable reactor identifier.

define Action<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

reactorType Type

The reactor type.

id ReactorId

Optional supplied identifier.

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

id ReactorId

Optional supplied identifier.

Returns

ExplicitArtifacts

The same options object for continuation.

Type Parameters

TReactor

The 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

TReadModel

Type 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

reducerType Type

The reducer type.

id ReducerId

Optional supplied identifier.

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

id ReducerId

Optional supplied identifier.

Returns

ExplicitArtifacts

The same options object for continuation.

Type Parameters

TReducer

The reducer type.