TextConfigurationProvider Class
Definition
- Namespace
- Bodu.Extensions.Configuration.Text
- Assembly
- Bodu.Extensions.Configuration.Text.dll
- Package
- Bodu.Extensions.Configuration.Text 1.0.0
A FileConfigurationProvider that parses a Bodu Text Configuration file and populates the configuration data dictionary with the resolved colon-delimited keys.
public sealed class TextConfigurationProvider : FileConfigurationProvider, IConfigurationProvider, IDisposable
- Inheritance
-
TextConfigurationProvider
- Implements
- Inherited Members
- Extension Methods
Examples
// Diagnostic introspection: locate the Bodu provider after the configuration root has been built.
IConfigurationRoot root = builder.Build();
TextConfigurationProvider? bodu = root.Providers
.OfType<TextConfigurationProvider>()
.FirstOrDefault();
if (bodu is not null)
{
Console.WriteLine($"Loaded from: {bodu.TextSource.Path}");
Console.WriteLine($"Reload on change: {bodu.TextSource.ReloadOnChange}");
}
Remarks
The provider inherits change-token, reload-on-change, optional-file, and exception-wrapping behaviour from FileConfigurationProvider. Override Load(Stream) only. The Parse → Resolve → flatten pipeline is shared with TextStreamConfigurationProvider 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
TextConfigurationProvider(TextConfigurationSource)
Initializes a new instance of the TextConfigurationProvider class backed by the supplied source.
public TextConfigurationProvider(TextConfigurationSource source)
Parameters
sourceTextConfigurationSourceThe source that produced this provider.
Exceptions
- ArgumentNullException
sourceis null.
Properties
TextSource
Gets the typed source that backs this provider.
public TextConfigurationSource TextSource { get; }
Property Value
- TextConfigurationSource
The originating TextConfigurationSource.
Methods
Load(Stream)
Loads this provider's data from a stream.
public override void Load(Stream stream)
Parameters
streamStreamThe stream to read.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |