Table of Contents

TextConfigurationSource Class

Definition

Namespace
Bodu.Extensions.Configuration.Text
Assembly
Bodu.Extensions.Configuration.Text.dll
Package
Bodu.Extensions.Configuration.Text 1.0.0
Source
TextConfigurationSource.cs

A FileConfigurationSource that reads a Bodu Text Configuration file and projects its resolved view into the IConfiguration hierarchy as colon-delimited keys.

public sealed class TextConfigurationSource : FileConfigurationSource, IConfigurationSource
Inheritance
TextConfigurationSource
Implements
Inherited Members
Extension Methods

Examples

// Typical lambda registration via the IConfigurationBuilder extension.
builder.Configuration.AddTextConfigurationFile(source =>
{
    source.Path           = "app.boduconfig";
    source.TargetPath     = "src/Web/Startup.cs"; // anchors glob sections like [src/**/*.cs]
    source.Optional       = false;
    source.ReloadOnChange = true;
    source.ParseOptions   = ConfigurationParseOptions.Strict;
});

// Direct construction - for example, in a custom builder host.
var source = new TextConfigurationSource
{
    Path           = "app.boduconfig",
    ReloadOnChange = true,
    TargetPath     = "src/Web/Startup.cs",
};
IConfigurationProvider provider = source.Build(builder);

Remarks

Inherits the standard reload-on-change, file-provider, and optional-file behaviours from FileConfigurationSource, matching the conventions used by the JSON, INI, and XML providers shipped by Microsoft. Three Bodu-specific properties extend the base contract: TargetPath drives glob-anchored section matching during resolution, ParseOptions controls how the document is read, and ResolveOptions controls how the resolved view is layered.

Most callers do not construct this type directly; reach for the AddTextConfigurationFile(IConfigurationBuilder, string, string?, bool, bool) extensions instead. Direct construction is appropriate when a host already has the source instance in hand - for example, when wiring a custom IConfigurationBuilder programmatically.

Constructors

TextConfigurationSource()

public TextConfigurationSource()

Properties

ParseOptions

Gets or sets the parse options applied when the file is loaded.

public ConfigurationParseOptions? ParseOptions { get; set; }

Property Value

ConfigurationParseOptions

The parse options, or null for the defaults.

ResolveOptions

Gets or sets the resolve options applied when projecting the document into the configuration view.

public ConfigurationResolveOptions? ResolveOptions { get; set; }

Property Value

ConfigurationResolveOptions

The resolve options, or null for the defaults.

TargetPath

Gets or sets the path used to evaluate glob-anchored sections during resolution. Defaults to null, in which case only non-anchored matches and preamble values apply.

public string? TargetPath { get; set; }

Property Value

string

The target path supplied to the resolver.

Methods

Build(IConfigurationBuilder)

Builds the IConfigurationProvider for this source.

public override IConfigurationProvider Build(IConfigurationBuilder builder)

Parameters

builder IConfigurationBuilder

The IConfigurationBuilder.

Returns

IConfigurationProvider

To be added.

Applies to

ProductVersions
.NET8, 10