Table of Contents

TextStreamConfigurationProvider Class

Definition

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

A StreamConfigurationProvider that parses a Bodu Text Configuration stream and populates the configuration data dictionary with the resolved colon-delimited keys.

public sealed class TextStreamConfigurationProvider : StreamConfigurationProvider, IConfigurationProvider
Inheritance
TextStreamConfigurationProvider
Implements
Inherited Members
Extension Methods

Examples

// Diagnostic introspection: locate the Bodu stream provider after the configuration root has been built.
IConfigurationRoot root = builder.Build();
TextStreamConfigurationProvider? bodu = root.Providers
    .OfType<TextStreamConfigurationProvider>()
    .FirstOrDefault();

if (bodu is not null)
{
    Console.WriteLine($"Target path: {bodu.TextSource.TargetPath ?? "<none>"}");
}

Remarks

Stream-backed providers are one-shot: the stream is consumed during the initial Load(Stream) call and no reload-on-change machinery is attached. For file-backed loading with reload support, use TextConfigurationProvider instead. The Parse → Resolve → flatten pipeline is shared with TextConfigurationProvider via Bodu.Extensions.Configuration.Text.TextConfigurationLoader.

Consumers do not construct this type directly - it is materialized by Build(IConfigurationBuilder) when an IConfigurationBuilder is built. The typed TextSource accessor exists for diagnostic scenarios where a host needs to inspect the source that produced a given IConfigurationProvider.

Constructors

TextStreamConfigurationProvider(TextStreamConfigurationSource)

Initializes a new instance of the TextStreamConfigurationProvider class backed by the supplied source.

public TextStreamConfigurationProvider(TextStreamConfigurationSource source)

Parameters

source TextStreamConfigurationSource

The source that produced this provider.

Exceptions

ArgumentNullException

source is null.

Properties

TextSource

Gets the typed source that backs this provider.

public TextStreamConfigurationSource TextSource { get; }

Property Value

TextStreamConfigurationSource

The originating TextStreamConfigurationSource.

Methods

Load(Stream)

Loads the configuration data from the stream.

public override void Load(Stream stream)

Parameters

stream Stream

The data stream.

Applies to

ProductVersions
.NET8, 10