Path: redb/redb.Core/Exceptions/RedbDictionaryKeyTooLongException.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Exceptions/RedbDictionaryKeyTooLongException.cs
----
using System;
namespace redb.Core.Exceptions;
///
/// A dictionary key is longer than the provider's _array_index column holds. SQL Server declares the column
/// NVARCHAR(430) (the index key width); PostgreSQL and SQLite have no bound and never raise this. The save
/// refuses before any row is written, so nothing stored changes.
///
public class RedbDictionaryKeyTooLongException : InvalidOperationException
{
/// Id of the object whose dictionary was rejected (0 or a temporary id for a new object).
public long ObjectId { get; }
/// Name of the dictionary property.
public string Property { get; }
/// Length of the serialized key, in UTF-16 code units.
public int Length { get; }
/// The provider's bound, in UTF-16 code units.
public int Limit { get; }
public RedbDictionaryKeyTooLongException(long objectId, string property, int length, int limit)
: base($"object id={objectId}: a key of dictionary '{property}' is {length} characters, " +
$"the limit on this provider is {limit}. Use a shorter key.")
{
ObjectId = objectId;
Property = property;
Length = length;
Limit = limit;
}
}