Path: redb/redb.Tests.Integration/Models/OlderModelModels.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.Tests.Integration/Models/OlderModelModels.cs
----
using redb.Core.Attributes;
namespace redb.Tests.Integration.Models;
// A newer and an older build of one Props class, for the older-model suite (OlderModelTestsBase). Two classes cannot
// share one scheme name in a process (ClrSchemeTypeIndex), so the newer class syncs and saves under its own name and
// the test renames that scheme to the older class's name: the older class then meets exactly the structures and values
// the newer build left.
/// The newer build: adds Extra.
[RedbScheme("Older model: new field, newer build", Name = "older_model_field_newer")]
public class OlderModelFieldNewerProps
{
public string Tag { get; set; } = "";
public string? Extra { get; set; }
}
/// The older build: no Extra.
[RedbScheme("Older model: new field, older build", Name = "older_model_field")]
public class OlderModelFieldOlderProps
{
public string Tag { get; set; } = "";
}
/// The newer build: Level is a long.
[RedbScheme("Older model: type change, newer build", Name = "older_model_type_newer", Version = 1)]
public class OlderModelTypeNewerProps
{
public string Tag { get; set; } = "";
public long Level { get; set; }
}
/// The older build: Level was a bool.
[RedbScheme("Older model: type change, older build", Name = "older_model_type")]
public class OlderModelTypeOlderProps
{
public string Tag { get; set; } = "";
public bool Level { get; set; }
}
/// The newer build: adds Country to the nested class and Note to the list element.
[RedbScheme("Older model: nested fields, newer build", Name = "older_model_nested_newer")]
public class OlderModelNestedNewerProps
{
public string Tag { get; set; } = "";
public OlderModelPlaceNewer? Place { get; set; }
public List? Lines { get; set; }
}
public class OlderModelPlaceNewer
{
public string City { get; set; } = "";
public string? Country { get; set; }
}
public class OlderModelLineNewer
{
public string Name { get; set; } = "";
public string? Note { get; set; }
}
/// The older build: no Country, no Note.
[RedbScheme("Older model: nested fields, older build", Name = "older_model_nested")]
public class OlderModelNestedOlderProps
{
public string Tag { get; set; } = "";
public OlderModelPlaceOlder? Place { get; set; }
public List? Lines { get; set; }
}
public class OlderModelPlaceOlder
{
public string City { get; set; } = "";
}
public class OlderModelLineOlder
{
public string Name { get; set; } = "";
}
/// A later build that removed Extra and raised the version: the sync may delete it.
[RedbScheme("Older model: field removed with a version", Name = "older_model_clean", Version = 1)]
public class OlderModelCleanProps
{
public string Tag { get; set; } = "";
}
/// The build before it, which still had Extra.
[RedbScheme("Older model: field removed, build before", Name = "older_model_clean_before")]
public class OlderModelCleanBeforeProps
{
public string Tag { get; set; } = "";
public string? Extra { get; set; }
}
// A type changed without raising the version: the sync holds the change, saves are refused.
[RedbScheme("Held type: bool, before", Name = "held_bool_before")] public class HeldBoolBeforeProps { public string Tag { get; set; } = ""; public bool Flag { get; set; } }
[RedbScheme("Held type: bool to int", Name = "held_bool")] public class HeldBoolToIntProps { public string Tag { get; set; } = ""; public int Flag { get; set; } }
[RedbScheme("Held type: text, before", Name = "held_text_before")] public class HeldTextBeforeProps { public string Tag { get; set; } = ""; public string Flag { get; set; } = ""; }
[RedbScheme("Held type: text to int", Name = "held_text")] public class HeldTextToIntProps { public string Tag { get; set; } = ""; public int Flag { get; set; } }
[RedbScheme("Held kind: scalar, before", Name = "held_kind_before")] public class HeldKindBeforeProps { public string Tag { get; set; } = ""; public string Flag { get; set; } = ""; }
[RedbScheme("Held kind: scalar to list", Name = "held_kind")] public class HeldKindToListProps { public string Tag { get; set; } = ""; public List? Flag { get; set; } }