Path: redb/redb.Examples/Examples/E164_BaseFieldsSingle.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.Examples/Examples/E164_BaseFieldsSingle.cs ---- using System.Diagnostics; using redb.Core; using redb.Core.Models.Entities; using redb.Examples.Output; namespace redb.Examples.Examples; /// /// Demonstrates using RedbObject base fields without Props (no props rows). /// Base fields are stored directly in _objects table for fast access: /// value_string, value_long, value_bool, value_double, value_datetime, value_guid, value_numeric, value_bytes. /// Useful for simple objects, lookups, metadata without dynamic properties. /// [ExampleMeta("E164", "Base Fields - Single Object", "Core", ExampleTier.Free, 164, "BaseFields", "RedbObject", "NoProps", RelatedApis = ["RedbObject", "IRedbService.SaveAsync"])] public class E164_BaseFieldsSingle : ExampleBase { public override async Task RunAsync(IRedbService redb) { var sw = Stopwatch.StartNew(); // Create non-generic RedbObject with base fields only (no Props rows) var obj = new RedbObject { name = $"BaseFields_Example_{DateTime.UtcNow.Ticks}", value_string = "Example String Value", value_long = 12345, value_bool = true, value_double = 3.14159, value_datetime = DateTime.UtcNow, value_numeric = 99.99m }; // Save - no _values table involved, only _objects var id = await redb.SaveAsync(obj); // Load back var loaded = (await redb.LoadAsync(new[] { id })).FirstOrDefault(); sw.Stop(); if (loaded == null) { return Fail("E164", "Base Fields - Single Object", ExampleTier.Free, sw.ElapsedMilliseconds, "Failed to load saved object."); } var result = Ok("E164", "Base Fields - Single Object", ExampleTier.Free, sw.ElapsedMilliseconds, 1, [$"ID: {id}, Name: {loaded.Name}", $"value_string: {loaded.ValueString}", $"value_long: {loaded.ValueLong}, value_bool: {loaded.ValueBool}"]); // Cleanup await redb.DeleteAsync(id); return result; } }