Table of Contents

Interface IUniqueConstraintBuilder

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

Defines the builder for building unique constraints.

public interface IUniqueConstraintBuilder

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.

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.

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.

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.