Class RedbUniqueViolationException

Assembly: redb.Core.dll

A save was rejected because a [RedbUnique] key is already taken by another object of the
scheme. Raised in place of the driver's own unique-violation error (PostgreSQL 23505, SQL Server
2601/2627, SQLite 2067) so that callers can catch one type on every provider and read which key
collided, rather than match on message text.

Everything but is best-effort: the driver message names the index and, on
PostgreSQL and SQL Server, the key tuple — from which the structure and therefore the scheme and
property are resolved. SQLite names only the columns. When something could not be resolved the
property is null; the original exception is always attached.

public class RedbUniqueViolationException : Exception, ISerializable

Inheritance

Object→Exception→RedbUniqueViolationException

Implements

Properties

Cause

The driver exception.

public Exception Cause { get; }

ConstraintName

Name of the unique index or constraint the database reported, when it did.

public string? ConstraintName { get; }

Detail

The driver's own detail line (PostgreSQL DETAIL, SQL Server message), verbatim.

public string? Detail { get; }

Kind

Which unique index rejected the save - the object key (ValueUnique) or a

public RedbUniqueViolationKind Kind { get; }

PropertyName

Property backing that structure, when resolved.

public string? PropertyName { get; }

SchemeId

Scheme of the object that was being saved, when resolved.

public long? SchemeId { get; }

SchemeName

Scheme name, when resolved.

public string? SchemeName { get; }

StructureId

Structure (field) whose key collided, when the driver reported the key tuple.

public long? StructureId { get; }

Constructors