Path: redb/redb.Core/Utils/RedbDictionaryOrder.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/Utils/RedbDictionaryOrder.cs
----
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace redb.Core.Utils;
///
/// The order in which a dictionary read from the database lists its entries: by key, the same on every provider and
/// in every read. A dictionary is stored as an unordered set (its hash ignores the order of entries), and a read used
/// to list them in the order of its rows (Pro) or of the JSON the free modules built (by key length on PostgreSQL, by
/// key text on SQL Server and SQLite), so the order moved between providers and, in Pro, between reads.
/// Simple keys sort by their value: strings ordinally, numbers, dates, times, Guids and enums as values, byte arrays
/// by their bytes. Composite keys (value tuples, classes) sort by the text they are stored under.
///
public static class RedbDictionaryOrder
{
private static readonly ConditionalWeakTable> ByKeyType = new();
/// The comparer of keys of type .
public static IComparer