ConfigurationResolveOptions Class
Definition
- Namespace
- Bodu.Text.Configuration
- Assembly
- Bodu.Text.Configuration.dll
- Package
- Bodu.Text.Configuration 1.0.0
Controls how a ConfigurationDocument is projected into a ConfigurationView for a specific target path.
public sealed class ConfigurationResolveOptions
- Inheritance
-
ConfigurationResolveOptions
- Inherited Members
- Extension Methods
Remarks
Resolution is path-aware: each section in the document either matches the supplied target path (under EditorConfig
glob semantics) or does not, and the resolved view layers the preamble and every matching section in source order,
with the last matching section's value winning. This options bag controls every variable that influences that
layering - which path root anchors anchored globs, whether preamble properties contribute, which string comparison
is used for path matching, and how the EditorConfig unset sentinel is handled.
PathRoot deserves attention when the document was parsed from a string rather than loaded from a file. With no path on the document and PathRoot left null, the resolver consults MissingPathRootMode to decide whether to use the empty root, throw, or fall back to the target path's parent - that choice changes which sections match.
KeyOptions should normally be the same instance passed to
KeyOptions so that lookups against the resolved view use the same comparer
and mapping that produced the parsed keys. The default Default matches the
Microsoft.Extensions.Configuration shape.
ConfigurationView view = document.Resolve(
"src/App/Program.cs",
new ConfigurationResolveOptions
{
Profile = ConfigurationProfile.EditorConfigCompatible,
UnsetValueMode = ConfigurationUnsetValueMode.RemoveEffectiveValue,
});
// Or start from a canonical profile option set and rely on its coherent defaults:
ConfigurationView strict = document.Resolve(null, ConfigurationResolveOptions.For(ConfigurationProfile.Strict));
Constructors
ConfigurationResolveOptions()
public ConfigurationResolveOptions()
Properties
ApplyPreambleProperties
Gets a value indicating whether preamble (global) properties contribute to resolution. Defaults to true for the Bodu profile and false for EditorConfig-compatible.
public bool ApplyPreambleProperties { get; init; }
Property Value
Bodu
Gets the canonical option set for the default Bodu profile.
public static ConfigurationResolveOptions Bodu { get; }
Property Value
- ConfigurationResolveOptions
A cached default options instance.
EditorConfigCompatible
Gets the canonical option set for the EditorConfig-compatible profile.
public static ConfigurationResolveOptions EditorConfigCompatible { get; }
Property Value
- ConfigurationResolveOptions
A cached EditorConfig-compatible options instance.
KeyOptions
Gets the key options used when expanding raw keys into configuration keys for the resolved view.
public ConfigurationKeyOptions KeyOptions { get; init; }
Property Value
- ConfigurationKeyOptions
The selected key options.
MissingPathRootMode
Gets how the resolver reacts to an absent PathRoot when the document was parsed from a string.
public ConfigurationMissingPathRootMode MissingPathRootMode { get; init; }
Property Value
- ConfigurationMissingPathRootMode
The selected mode.
PathComparison
Gets the comparison used when matching target paths against section patterns.
public StringComparison PathComparison { get; init; }
Property Value
- StringComparison
The selected StringComparison.
PathRoot
Gets the optional path root used to evaluate anchored glob patterns. When null the document's load path is used; if neither is available, MissingPathRootMode controls behaviour.
public string? PathRoot { get; init; }
Property Value
Profile
Gets the behaviour profile this option bag represents.
public ConfigurationProfile Profile { get; init; }
Property Value
- ConfigurationProfile
The selected profile.
UnsetValueMode
Gets the unset-value handling mode used by the resolver.
public ConfigurationUnsetValueMode UnsetValueMode { get; init; }
Property Value
- ConfigurationUnsetValueMode
The selected unset-value mode.
Methods
For(ConfigurationProfile)
Returns the canonical option set for the specified profile.
public static ConfigurationResolveOptions For(ConfigurationProfile profile)
Parameters
profileConfigurationProfileThe profile to materialize.
Returns
- ConfigurationResolveOptions
An options instance configured for
profile.
Exceptions
- ArgumentOutOfRangeException
profileis not a defined value.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |