Interface IUniqueConstraintBuilder

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

Defines the builder for building unique constraints.

public interface IUniqueConstraintBuilder
Extension Methods

Methods

Build()

Builds the unique constraint.

IConstraintDefinition Build()

Returns

IConstraintDefinition

A IConstraintDefinition to use for registering with server.

IgnoreCasing()

Ignore casing during comparison.

IUniqueConstraintBuilder IgnoreCasing()

Returns

IUniqueConstraintBuilder

Builder for continuation.

On(EventType, string[])

Constrain on a specific property on an event.

IUniqueConstraintBuilder On(EventType eventType, string[] properties)

Parameters

eventType EventType

The EventType the property belongs to.

properties string[]

Property names.

Returns

IUniqueConstraintBuilder

Builder for continuation.

On<TEventType>(params Expression<Func<TEventType, object>>[])

Constrain on a specific property on an event.

IUniqueConstraintBuilder On<TEventType>(params Expression<Func<TEventType, object>>[] properties)

Parameters

properties Expression<Func<TEventType, object>>[]

Expressions for specifying the properties on the event.

Returns

IUniqueConstraintBuilder

Builder for continuation.

Type Parameters

TEventType

Type of event the property belongs to.

RemovedWith(EventType)

Indicate an event that will remove the unique constraint.

IUniqueConstraintBuilder RemovedWith(EventType eventType)

Parameters

eventType EventType

The EventType that would remove the constraint.

Returns

IUniqueConstraintBuilder

The builder for continuation.

Remarks

Call this as many times as the lifecycle has terminal facts. Every declared event type releases the constraint on its own — declaring a second does not replace the first.

RemovedWith(EventType, string[])

Declares a removal event carrying the value to release in per-value mode.

IUniqueConstraintBuilder RemovedWith(EventType eventType, string[] properties)

Parameters

eventType EventType

The removal event type.

properties string[]

Property names in constrained-property order; empty releases all values.

Returns

IUniqueConstraintBuilder

Builder for continuation.

RemovedWith<TEventType>()

Indicate an event that will remove the unique constraint.

IUniqueConstraintBuilder RemovedWith<TEventType>()

Returns

IUniqueConstraintBuilder

Builder for continuation.

Type Parameters

TEventType

The EventType that removes the constraint.

Remarks

Call this as many times as the lifecycle has terminal facts. Every declared event type releases the constraint on its own — declaring a second does not replace the first.

RemovedWith<TEventType>(params Expression<Func<TEventType, object>>[])

Declares a removal event carrying the value to release in per-value mode.

IUniqueConstraintBuilder RemovedWith<TEventType>(params Expression<Func<TEventType, object>>[] properties)

Parameters

properties Expression<Func<TEventType, object>>[]

Properties in the same order as the constrained properties; empty releases all values.

Returns

IUniqueConstraintBuilder

Builder for continuation.

Type Parameters

TEventType

Type of removal event.

WithMessage(ConstraintViolationMessageProvider)

Specifies a provider that will provide a message to use when the unique constraint is violated.

IUniqueConstraintBuilder WithMessage(ConstraintViolationMessageProvider messageProvider)

Parameters

messageProvider ConstraintViolationMessageProvider

Callback that provides the message.

Returns

IUniqueConstraintBuilder

Builder for continuation.

WithMessage(string)

Specifies a message to use when the unique constraint is violated.

IUniqueConstraintBuilder WithMessage(string message)

Parameters

message string

Message to use.

Returns

IUniqueConstraintBuilder

Builder for continuation.

WithMode(UniqueConstraintMode)

Specifies how claimed values are retained; the default keeps one value per event source.

IUniqueConstraintBuilder WithMode(UniqueConstraintMode mode)

Parameters

mode UniqueConstraintMode

The retention mode.

Returns

IUniqueConstraintBuilder

Builder for continuation.

WithName(ConstraintName)

Defines the name of the unique constraint.

IUniqueConstraintBuilder WithName(ConstraintName name)

Parameters

name ConstraintName

Name to use.

Returns

IUniqueConstraintBuilder

Builder for continuation.

Remarks

The name is optional and if not provided, it will use the type name in which the unique constraint belongs to.