Path: redb/redb.Tests.Integration/Models/RenameModels.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/RenameModels.cs ---- using redb.Core.Attributes; namespace redb.Tests.Integration.Models; // Props for the [RedbRename] suite. Each scenario is a pair (or a chain) of classes for one scheme: the "V1" class is // the class of an older application version, with no explicit scheme name, so its scheme is named after its FullName; // the later classes pin that FullName as their explicit name. That is how a rename is deployed in the field (the class // changes, the scheme stays), and it keeps the library's guard against two classes claiming one explicit name out of // the way: only one class of each scheme declares the name. /// Older class: a root field and a nested field that the next version renames. public class RenameBasicV1 { public string Title { get; set; } = ""; public long Count { get; set; } public RenameAddressV1 Address { get; set; } = new(); } public class RenameAddressV1 { public string City { get; set; } = ""; public string Street { get; set; } = ""; } /// Next version: Title is Heading, Address.City is Address.Town. [RedbScheme(Name = "redb.Tests.Integration.Models.RenameBasicV1")] public class RenameBasicV2 { [RedbRename("Title")] public string Heading { get; set; } = ""; public long Count { get; set; } public RenameAddressV2 Address { get; set; } = new(); } public class RenameAddressV2 { [RedbRename("City")] public string Town { get; set; } = ""; public string Street { get; set; } = ""; } /// Chain: Title, then Heading (staged by SQL: a second class claiming the explicit name would be a name /// conflict), then Caption. public class RenameChainV1 { public string Title { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameChainV1")] public class RenameChainV3 { [RedbRename("Title")] [RedbRename("Heading")] public string Caption { get; set; } = ""; } /// Separate scheme for the direct jump V1 to V3 of the chain. public class RenameJumpV1 { public string Title { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameJumpV1")] public class RenameJumpV3 { [RedbRename("Title")] [RedbRename("Heading")] public string Caption { get; set; } = ""; } /// The database stores both the previous name and the new one. public class RenameBothV1 { public string Title { get; set; } = ""; public string Heading { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameBothV1")] public class RenameBothV2 { [RedbRename("Title")] public string Heading { get; set; } = ""; } /// A previous name that another property of the same class carries again: read once the rename is applied. public class RenameClashProps { [RedbRename("Title")] public string Heading { get; set; } = ""; public string Title { get; set; } = ""; } /// A name freed by a rename (Title to Heading, staged by SQL) is taken again by a new property. public class RenameReuseV1 { public string Title { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameReuseV1")] public class RenameReuseV3 { [RedbRename("Title")] public string Heading { get; set; } = ""; public string Title { get; set; } = ""; } /// Rename and type change at once: int Count becomes long Total (both live in _Long). public class RenameTypeV1 { public int Count { get; set; } } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameTypeV1")] public class RenameTypeV2 { [RedbRename("Count")] public long Total { get; set; } } /// A rename that moves the property across another in name order: Title sorts after Alpha, Aaron before. public class RenameHashV1 { public string Alpha { get; set; } = ""; public string Title { get; set; } = ""; public string Zulu { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameHashV1")] public class RenameHashV2 { [RedbRename("Title")] public string Aaron { get; set; } = ""; public string Alpha { get; set; } = ""; public string Zulu { get; set; } = ""; } /// Two properties that swap names through a temporary name: Left to Tmp, Right to Left, Tmp to Right (the first two /// deployments are staged by SQL). public class RenameSwapV1 { public string Left { get; set; } = ""; public string Right { get; set; } = ""; } [RedbScheme(Name = "redb.Tests.Integration.Models.RenameSwapV1")] public class RenameSwapV3 { [RedbRename("Left")] [RedbRename("Tmp")] public string Right { get; set; } = ""; [RedbRename("Right")] public string Left { get; set; } = ""; } /// A swap in one step: refused from the class alone (no [RedbScheme], so the fixture does not sync it). public class RenameSwapOneStep { [RedbRename("Left")] public string Right { get; set; } = ""; [RedbRename("Right")] public string Left { get; set; } = ""; }