Use name aliases

Requires: abstractions module.

Name aliases provide alternative keys to look for in settings nodes when performing binding.

They can be applied to fields and properties with a special attribute:

class MySettings 
{
    [Alias("LegacyTimeout")]
    public TimeSpan Timeout { get; }
}

// The property can be initialized from either "timeout" or "legacytimeout" key

It's allowed to assign multiple aliases to a single member:

[Alias("alias1")]
[Alias("alias2")]
public TimeSpan Timeout { get; }

Aliases do not handle ambiguity. If the source returns data with more than one of the lookup keys assigned to a field or property, binding fails with an error.

Ambiguous data examples:
{ "timeout": "...", "alias1": "..." }
{ "alias1": "...", "alias2": "..." }

Last updated