Eigenverft.NetLib.Configuration.SwitchableJson
1.0.0.5-gdfdd996480
dotnet add package Eigenverft.NetLib.Configuration.SwitchableJson --version 1.0.0.5-gdfdd996480
NuGet\Install-Package Eigenverft.NetLib.Configuration.SwitchableJson -Version 1.0.0.5-gdfdd996480
<PackageReference Include="Eigenverft.NetLib.Configuration.SwitchableJson" Version="1.0.0.5-gdfdd996480" />
<PackageVersion Include="Eigenverft.NetLib.Configuration.SwitchableJson" Version="1.0.0.5-gdfdd996480" />
<PackageReference Include="Eigenverft.NetLib.Configuration.SwitchableJson" />
paket add Eigenverft.NetLib.Configuration.SwitchableJson --version 1.0.0.5-gdfdd996480
#r "nuget: Eigenverft.NetLib.Configuration.SwitchableJson, 1.0.0.5-gdfdd996480"
#:package Eigenverft.NetLib.Configuration.SwitchableJson@1.0.0.5-gdfdd996480
#addin nuget:?package=Eigenverft.NetLib.Configuration.SwitchableJson&version=1.0.0.5-gdfdd996480&prerelease
#tool nuget:?package=Eigenverft.NetLib.Configuration.SwitchableJson&version=1.0.0.5-gdfdd996480&prerelease
Eigenverft.NetLib.Configuration.SwitchableJson
Register JSON as a normal configuration provider, with an isolated preparation step before publication and a stable runtime handle for deliberate source changes.
✨ At a glance
| Package | Eigenverft.NetLib.Configuration.SwitchableJson |
| Registration | AddSwitchableJsonFile(...) |
| Runtime API | ISwitchableJsonConfiguration.TrySwitch(...) |
| Failure behavior | Reject failed candidates; keep the active snapshot by default |
| Optional capabilities | File watching, candidate preparation, value protection |
| Target frameworks | .NET 8 and .NET 10 |
| License | MIT |
📦 Installation
dotnet add package Eigenverft.NetLib.Configuration.SwitchableJson
🚀 Quick start
Create both files with valid JSON before running this example; the initial file is required by default. Resolve a keyed runtime handle from DI after building the host to switch to another file:
using System.IO;
using Eigenverft.NetLib.Configuration.SwitchableJson;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
string settings = Path.Combine(builder.Environment.ContentRootPath, "settings");
string normalPath = Path.Combine(settings, "Operational.Normal.json");
string incidentPath = Path.Combine(settings, "Operational.Incident.json");
builder.AddSwitchableJsonFile(
name: "OperationalSettings",
initialPath: normalPath,
reloadOnChange: true);
using IHost host = builder.Build();
ISwitchableJsonConfiguration source =
host.Services.GetRequiredKeyedService<ISwitchableJsonConfiguration>(
"OperationalSettings");
SwitchableJsonSwitchResult result = source.TrySwitch(incidentPath);
if (!result.Succeeded)
{
// The previous active source and published configuration remain in place.
}
The provider stays at its registered precedence. Changes flow through normal IConfiguration reload behavior when the effective values change.
🧭 Preparation, reload, and protection
An initial path may be absolute or relative to the host content root. Each initial load, file reload, or requested source switch is parsed and prepared as a candidate before the published snapshot changes. A missing, invalid, inaccessible, or rejected candidate leaves the last successful snapshot active. ReloadOnChange is opt-in; the default is false. Manual failures keep the current source by default, or can be configured to throw with SwitchableJsonRuntimeFailurePolicy.Throw.
Set SwitchableJsonRegistrationOptions.CandidatePreparation to an application-defined IJsonConfigurationSourcePreparation or a bundle from JsonConfigurationCandidatePreparations.Compose(...). Preparation steps run in order against an isolated candidate. If several sources must change as one unit, use Eigenverft.NetLib.Configuration.Sets, which builds on this package.
Optional ValueProtection selects JSON key names or full configuration paths and uses codecs from Eigenverft.NetLib.Configuration.Values. Matching plaintext values may be written back in encoded form during registration or later source loads, so the application needs write access when matching clear text is present. Protection is load-bound; it is not a continuous file-watcher invariant. The registered decoder runs before candidate preparation. Codec strength varies: reversible transforms such as Base64 or ROT13 are not cryptographic confidentiality; choose an appropriate codec for the deployment threat model.
The runtime handle exposes LifecycleChanged independently of IConfiguration change tokens. A completed switch or reload can be observable through that event even when the effective key/value snapshot is unchanged. Do not use ordinary file reload as a transaction mechanism across multiple files; use Configuration Sets for that.
🎯 Target frameworks
The package targets net8.0 and net10.0.
🔗 Project links
📄 License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Eigenverft.NetLib.Configuration.Values (>= 1.0.0.6-gdfdd996480)
- Microsoft.Extensions.Hosting (>= 10.0.0)
-
net8.0
- Eigenverft.NetLib.Configuration.Values (>= 1.0.0.6-gdfdd996480)
- Microsoft.Extensions.Hosting (>= 8.0.1)
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0.5-gdfdd996480 | 0 | 9/29/2026 |
| 1.0.0.5-g17613f8942 | 0 | 9/29/2026 |
| 1.0.0.3-g28e841270d | 0 | 9/28/2026 |
| 1.0.0.2-gbac57d8b97 | 0 | 9/11/2026 |
| 1.0.0.2-g9537b96514 | 0 | 9/11/2026 |
Initial capability package extracted from Eigenverft.NetLib.Infrastructure.