Path: redb/redb.Core/Models/Contracts/IRedbObject.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/Models/Contracts/IRedbObject.cs
----
using System;
namespace redb.Core.Models.Contracts
{
///
/// Base interface for all REDB objects
/// Allows working with objects as classes rather than IDs
/// Enriched with full functionality for working with trees, timestamps and auditing
///
public interface IRedbObject
{
// ===== BASIC IDENTIFIERS =====
///
/// Unique object identifier
/// Used for extracting ID from object in new methods
///
long Id { get; set; }
///
/// Object scheme identifier
/// Used for schema permissions checking and validation
///
long SchemeId { get; set; }
///
/// Object name
/// Used for logging, debugging and user interface
///
string Name { get; set; }
// ===== TREE STRUCTURE =====
///
/// Parent object identifier
/// null - if object is root
///
long? ParentId { get; set; }
///
/// Checks if object has a parent
///
bool HasParent { get; }
///
/// Checks if object is root (has no parent)
///
bool IsRoot { get; }
// ===== TIMESTAMPS =====
///
/// Object creation date and time
///
DateTimeOffset DateCreate { get; set; }
///
/// Object last modification date and time
///
DateTimeOffset DateModify { get; set; }
///
/// Object validity start date (optional)
///
DateTimeOffset? DateBegin { get; set; }
///
/// Object validity end date (optional)
///
DateTimeOffset? DateComplete { get; set; }
// ===== OWNERSHIP AND AUDIT =====
///
/// Object owner identifier
///
long OwnerId { get; set; }
///
/// Identifier of user who last modified the object
///
long WhoChangeId { get; set; }
// ===== ADDITIONAL IDENTIFIERS =====
///
/// Object key field
///
long? Key { get; set; }
// ===== PRIMITIVE VALUES (stored directly in _objects table) =====
///
/// Primitive long value (for primitive schemas)
///
long? ValueLong { get; set; }
///
/// Primitive string value (for primitive schemas)
///
/// Identifier / external-key value; contract limit 450 (C#-enforced), long text belongs in Note.
string? ValueString { get; set; }
///
/// Primitive GUID value (for primitive schemas)
///
Guid? ValueGuid { get; set; }
///
/// Primitive boolean value (for primitive schemas)
///
bool? ValueBool { get; set; }
///
/// Primitive double value (for primitive schemas)
///
double? ValueDouble { get; set; }
///
/// Primitive decimal value (for primitive schemas)
///
decimal? ValueNumeric { get; set; }
///
/// Primitive datetime value (for primitive schemas)
///
DateTimeOffset? ValueDatetime { get; set; }
///
/// Primitive byte array value (for primitive schemas)
///
byte[]? ValueBytes { get; set; }
///
/// Application-defined unique key of the object within its scheme (V4, UNIQUE stage 1).
/// A plain readable string up to 440 characters; the database enforces uniqueness over
/// (_id_scheme, _value_unique). NULL never participates; a soft-deleted object releases its
/// key. Composite keys are the application's concatenation with a separator impossible
/// inside a component. Compared exactly as the database compares strings - redb neither
/// trims nor folds case.
///
string? ValueUnique { get; set; }
// ===== OBJECT STATE =====
///
/// Object notes
///
string? Note { get; set; }
///
/// MD5 hash of object for integrity control
///
Guid? Hash { get; set; }
///
/// Reset object ID to 0 and optionally ParentId to null
///
/// If true, also resets ParentId to null (default true)
void ResetId(bool withParent = true);
///
/// Reset object ID and ParentId (recursively processes nested objects)
///
/// If true, recursively resets ID in all nested IRedbObject in Props
void ResetIds(bool recursive = false);
}
}