Path: redb/redb.Core/Attributes/UniqueScope.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/Attributes/UniqueScope.cs
----
namespace redb.Core.Attributes;
///
/// Scope of a key on a COLLECTION property (S3 of the
/// subtree-unique plan). On scalars and nested classes the scope is not configurable - the
/// bare attribute already means the strongest sensible reading (value unique per scheme,
/// subtree content unique per scheme).
///
public enum UniqueScope
{
///
/// The default reading of the bare attribute: for a scalar - the value canon; for a class,
/// array or dictionary - the SUBTREE content key (no two objects hold this exact content).
///
Default = 0,
///
/// Element scope, scheme-wide: every ELEMENT value of the collection is unique across all
/// objects of the scheme ("this email appears in one object only, whichever array it sits
/// in"). References canonicalise by target id: "this object is attached at most once in
/// the whole scheme".
///
Scheme = 1,
///
/// Element scope, per collection: no duplicate element values INSIDE one object's
/// collection; different objects may repeat each other freely. The classic "unique set" -
/// for references: "no duplicate links in this collection".
///
Collection = 2,
}