Eigenverft.NetLib.Infrastructure
  • Guides
  • API
Show / Hide Table of Contents
  • Eigenverft.NetLib.Infrastructure.Hosting.Configuration.ConfigurationSets
    • ConfigurationSetApplyMode
    • ConfigurationSetBuilderBindingExtensions
    • ConfigurationSetCoordinatorExtensions
    • ConfigurationSetDefinition
    • ConfigurationSetEventArgs
    • ConfigurationSetEventKind
    • ConfigurationSetNotification
    • ConfigurationSetParticipantSwitchResult
    • ConfigurationSetPendingRestartChange
    • ConfigurationSetRegistration
    • ConfigurationSetStateApplyResult
    • ConfigurationSetStateApplyStatus
    • ConfigurationSetStateFailureKind
    • ConfigurationSetStateStatus
    • ConfigurationSetStateStoreEventArgs
    • ConfigurationSetStateStoreEventKind
    • ConfigurationSetStateStoreExtensions
    • ConfigurationSetStateStoreStatus
    • ConfigurationSetStatus
    • ConfigurationSetSwitchFailureKind
    • ConfigurationSetSwitchResult
    • ConfigurationSetSwitchStatus
    • ConfigurationSetSwitchableJsonExtensions
    • IConfigurationSetCoordinator
    • IConfigurationSetDesiredStateStore
    • IConfigurationSetEventHub
    • IConfigurationSetManager
    • IConfigurationSetStateStore
  • Eigenverft.NetLib.Infrastructure.Hosting.Configuration.Diagnostics
    • ConfigurationPrecedenceDiagnosticsExtensions
  • Eigenverft.NetLib.Infrastructure.Hosting.Configuration.Sources
    • HostApplicationBuilderConfigurationExtensions
  • Eigenverft.NetLib.Infrastructure.Hosting.Configuration.SwitchableJson
    • IJsonConfigurationSourcePreparation
    • ISwitchableJsonConfiguration
    • JsonConfigurationCandidatePreparation
    • JsonConfigurationCandidatePreparations
    • JsonConfigurationSourcePreparationContext
    • JsonConfigurationSourcePreparationException
    • JsonConfigurationValueProtection
    • SwitchableJsonConfigurationEventArgs
    • SwitchableJsonConfigurationEventKind
    • SwitchableJsonConfigurationExtensions
    • SwitchableJsonFailureKind
    • SwitchableJsonPreparationStatus
    • SwitchableJsonRegistrationOptions
    • SwitchableJsonRuntimeFailurePolicy
    • SwitchableJsonSwitchPreparation
    • SwitchableJsonSwitchResult
    • SwitchableJsonSwitchStatus
  • Eigenverft.NetLib.Infrastructure.Hosting.Configuration.Values
    • ConfigurationValueCodec
    • ConfigurationValueCodecs
    • ConfigurationValueKind
    • JsonConfigurationFileEncoder
  • Eigenverft.NetLib.Infrastructure.Hosting.DirectoryLayout
    • AppDirectoryLayout
    • AppDirectoryLayoutFactory
    • DefaultDirectory
    • DefaultDirectoryExtensions
    • DefaultDirectoryNameAttribute
    • HostApplicationBuilderDirectoryLayoutExtensions
    • HostApplicationBuilderFactory
    • IAppDirectoryLayout
  • Eigenverft.NetLib.Infrastructure.Hosting.Logging.BootstrapLogger
    • BootstrapLogger
    • BootstrapLogger<TCategoryName>
  • Eigenverft.NetLib.Infrastructure.Security.Certificates
    • CertificateKeyProfile
    • CertificatePurpose
    • CertificateRecoveryMode
    • CertificateSubject
    • ManagedCertificateAction
    • ManagedCertificateFile
    • ManagedCertificateFileOptions
    • ManagedCertificateResult
    • SelfSignedCertificateFactory
    • SelfSignedCertificateOptions
  • Eigenverft.NetLib.Infrastructure.Security.MachineBinding
    • PhysicalMachineBinding
  • Eigenverft.NetLib.Infrastructure.Text
    • Base92JsonSafeEncoder
  • Eigenverft.NetLib.Infrastructure.Transformations
    • ReversibleStringTransform
    • ReversibleStringTransform.TryReverseDelegate
    • ReversibleStringTransforms

Class SwitchableJsonConfigurationExtensions

Registers switchable JSON configuration sources and their runtime control handles.

Inheritance
object
SwitchableJsonConfigurationExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Eigenverft.NetLib.Infrastructure.Hosting.Configuration.SwitchableJson
Assembly: Eigenverft.NetLib.Infrastructure.dll
Syntax
public static class SwitchableJsonConfigurationExtensions

Methods

| Edit this page View Source

AddSwitchableJsonFile(IHostApplicationBuilder, string, string, SwitchableJsonRegistrationOptions)

Adds one switchable JSON source with the complete registration options, including ordered candidate source preparations.

Declaration
public static IHostApplicationBuilder AddSwitchableJsonFile(this IHostApplicationBuilder builder, string name, string initialPath, SwitchableJsonRegistrationOptions options)
Parameters
Type Name Description
IHostApplicationBuilder builder
string name
string initialPath
SwitchableJsonRegistrationOptions options
Returns
Type Description
IHostApplicationBuilder
| Edit this page View Source

AddSwitchableJsonFile(IHostApplicationBuilder, string, string, bool, bool, int, SwitchableJsonRuntimeFailurePolicy)

Adds one JSON configuration source that can later switch to another JSON file through keyed dependency injection.

Declaration
public static IHostApplicationBuilder AddSwitchableJsonFile(this IHostApplicationBuilder builder, string name, string initialPath, bool optional = false, bool reloadOnChange = false, int reloadDelayMilliseconds = 250, SwitchableJsonRuntimeFailurePolicy runtimeFailurePolicy = SwitchableJsonRuntimeFailurePolicy.KeepLastKnownGood)
Parameters
Type Name Description
IHostApplicationBuilder builder

The host application builder receiving both the configuration source and runtime handle.

string name

Caller-defined provider identity and keyed-service key.

string initialPath

Initial JSON path, absolute or relative to the host content root.

bool optional

Whether a missing source is treated as empty during framework-driven provider loads, including the initial load and explicit Reload() operations.

bool reloadOnChange

Whether the currently active source is watched for physical file changes after initial load and after each successful switch.

int reloadDelayMilliseconds

Debounce delay applied to physical file notifications before the active source is prepared again. The default mirrors the conventional Microsoft file-configuration reload delay.

SwitchableJsonRuntimeFailurePolicy runtimeFailurePolicy

How failed manual runtime candidate loads are reported after the host is running.

Returns
Type Description
IHostApplicationBuilder

The same builder for chaining.

Remarks

The registration is deliberately on IHostApplicationBuilder rather than only IConfigurationBuilder because one operation must add an IConfiguration source and a DI runtime handle. A split configuration/service registration API is possible, but would make it easier to accidentally register only one half. The provider identity is otherwise completely agnostic and carries no profile, environment, or directory semantics. File watching is opt-in and independent from manual source switching.

The keyed DI object is a stable runtime handle, not the concrete IConfigurationProvider instance. ConfigurationManager may rebuild concrete providers when its Sources collection changes; the source creates a fresh provider for every Build while the runtime handle preserves the selected source, watcher and lifecycle subscriptions.

  • Edit this page
  • View Source
In this article
Back to top