ConfigurationProfile Enum
Definition
- Namespace
- Bodu.Text.Configuration
- Assembly
- Bodu.Text.Configuration.dll
- Package
- Bodu.Text.Configuration 1.0.0
- Source
- ConfigurationProfile.cs
Selects one of the predefined behaviour profiles that govern how a configuration document is parsed, resolved, and re-emitted.
public enum ConfigurationProfile
- Extension Methods
Fields
Bodu = 0The default Bodu profile: EditorConfig-style section headers and globs, dotted-to-colon key mapping, last-wins duplicate handling, whitespace-introduced inline comments, and preamble properties contributing to resolution.
EditorConfigCompatible = 1Strict alignment with the public EditorConfig specification 0.17.2: inline comments disabled, the preamble's
rootkey alone participates in resolution, identity key mapping.Strict = 2Strict, deterministic parsing for generated files: duplicate keys are rejected, unknown syntax throws, inline comments are disabled, and key-only properties are not permitted.
Relaxed = 3Permissive parsing for user-authored files: inline comments enabled, duplicates resolved by last-wins, diagnostics collected rather than thrown.
Examples
// Start from the profile closest to the desired behaviour, then override only what differs.
ConfigurationParseOptions options = ConfigurationParseOptions.For(ConfigurationProfile.Strict);
ConfigurationDocument document = ConfigurationDocument.Parse(text, options);
Remarks
A profile is the single source of truth for an option set. Each ConfigurationParseOptions,
ConfigurationResolveOptions, and ConfigurationWriteOptions exposes a
For(profile) factory which produces an options bag preconfigured for the selected profile.
Profiles encode opinionated combinations of orthogonal switches. Mixing them is supported - start from the closest preset and override the few properties that differ. The behavioural matrix is:
| Behaviour | Bodu | EditorConfigCompatible | Strict | Relaxed |
|---|---|
| Inline comments (ConfigurationInlineCommentMode) | WhitespaceIntroduced | Disabled | Disabled | WhitespaceIntroduced |
| Duplicate keys (DuplicateKeyPolicy) | LastWins | LastWins | Disallowed | LastWins |
| Duplicate sections (IniDuplicateSectionBehavior) | Preserve | Preserve | Disallowed | Preserve |
| Section header trailing content (ConfigurationSectionHeaderMode) | Lenient | Strict | Strict | Lenient |
| Diagnostic routing (ConfigurationDiagnosticMode) | Throw | Throw | Throw | Collect |
| Preamble contributes to resolved view (ApplyPreambleProperties) | Yes | No | Yes | Yes |
unset sentinel (ConfigurationUnsetValueMode) | TreatAsLiteral | RemoveEffectiveValue | RemoveEffectiveValue | TreatAsLiteral |
| Missing path root (ConfigurationMissingPathRootMode) | UseEmptyRoot | Throw | Throw | UseEmptyRoot |
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |