Table of Contents

Class ConstraintBuilder

Namespace
Cratis.Chronicle.Events.Constraints
Assembly
Cratis.Chronicle.dll

Represents an implementation of IConstraintBuilder.

public class ConstraintBuilder : IConstraintBuilder
Inheritance
ConstraintBuilder
Implements
Inherited Members

Constructors

ConstraintBuilder(IEventTypes, Type?)

Represents an implementation of IConstraintBuilder.

public ConstraintBuilder(IEventTypes eventTypes, Type? owner = null)

Parameters

eventTypes IEventTypes

Event types for the builder.

owner Type

Optional owner of the constraint.

Methods

AddConstraint(IConstraintDefinition)

Add a constraint to the builder.

public void AddConstraint(IConstraintDefinition constraint)

Parameters

constraint IConstraintDefinition

Cratis.Chronicle.Contracts.Events.Constraints.Constraint to add.

Build()

Build the constraint.

public IImmutableList<IConstraintDefinition> Build()

Returns

IImmutableList<IConstraintDefinition>

A collection of IConstraintDefinition to use for registering with server.

Unique(Action<IUniqueConstraintBuilder>)

Start building a unique constraint.

public IConstraintBuilder Unique(Action<IUniqueConstraintBuilder> callback)

Parameters

callback Action<IUniqueConstraintBuilder>

Callback with IUniqueConstraintBuilder for building.

Returns

IConstraintBuilder

Builder for continuation.

Unique<TEventType>(ConstraintViolationMessage?, ConstraintName?)

Adds a unique constraint for a specific event type. This means there can only be one instance of this event type per event source identifier.

public IConstraintBuilder Unique<TEventType>(ConstraintViolationMessage? message = null, ConstraintName? name = null)

Parameters

message ConstraintViolationMessage

Optional message for the constraint.

name ConstraintName

Optional name for the constraint.

Returns

IConstraintBuilder

Builder for continuation.

Type Parameters

TEventType

Type of event to add for.

Unique<TEventType>(ConstraintViolationMessageProvider, ConstraintName?)

Adds a unique constraint for a specific event type. This means there can only be one instance of this event type per event source identifier.

public IConstraintBuilder Unique<TEventType>(ConstraintViolationMessageProvider messageCallback, ConstraintName? name = null)

Parameters

messageCallback ConstraintViolationMessageProvider

Callback for providing message for the constraint.

name ConstraintName

Optional name for the constraint.

Returns

IConstraintBuilder

Builder for continuation.

Type Parameters

TEventType

Type of event to add for.