maple-Configuration.OptionsUpdateable 0.1.2

dotnet add package maple-Configuration.OptionsUpdateable --version 0.1.2
                    
NuGet\Install-Package maple-Configuration.OptionsUpdateable -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="maple-Configuration.OptionsUpdateable" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="maple-Configuration.OptionsUpdateable" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="maple-Configuration.OptionsUpdateable" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add maple-Configuration.OptionsUpdateable --version 0.1.2
                    
#r "nuget: maple-Configuration.OptionsUpdateable, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package maple-Configuration.OptionsUpdateable@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=maple-Configuration.OptionsUpdateable&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=maple-Configuration.OptionsUpdateable&version=0.1.2
                    
Install as a Cake Tool

Configuration.OptionsUpdateable

.NET Tests

The Configuration.OptionsUpdateable namespace provides a set of classes and interfaces that facilitate the management and updating of configuration options in a flexible and dynamic manner. This namespace is designed to help developers easily modify configuration settings at runtime without requiring application restarts.

Code Coverage

Code coverage for Configuration.OptionsUpdateable is automatically collected with each build:

  • Pull Requests: Coverage summary and badge are posted as PR comments
  • Workflow Runs: View coverage details in the workflow run summary on the Actions tab
  • Detailed Reports: Download the full HTML coverage report from workflow artifacts

Key Features

  • Dynamic Updates: Allows for real-time updates to configuration options, enabling applications to adapt to changing requirements without downtime.

  • Type Safety: Utilizes strong typing to ensure that configuration options are valid and consistent throughout the application.

  • Validation Support: Integrates with validation mechanisms to ensure that updated configuration options meet predefined criteria. Functionality is based on FluentValidation library

Usage

To use the Configuration.OptionsUpdateable namespace, you typically start by defining your configuration options as a class. You can then register this class with the dependency injection container and use the provided interfaces to update the options as needed.

Working example can be found here:

using System;
using Configuration.OptionsUpdateable;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

// Define your configuration options class
public class MyConfigOptions : IConfigModel<MyConfigOptions>
{
	public string SettingA { get; set; }
	public int SettingB { get; set; }

	public Position DeepClone()
    {
		// Create a deep copy of the current instance
		// This is a simple example; for complex objects, ensure all nested objects are also cloned
        return this with { };
    }
}

// Register the options in the service collection
string configFolder = Path.Combine( System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "MyApp/Config");
builder.ConfigureUpdateableOptions(new UpdateableOptionsConfig
{
    ConfigurationFolder = configFolder,
    ValidateAtStartup = true,
    Validators = 
	[
		new PositionValidator()
	]
});


// Inject IUpdateableOptions to update options at runtime
public class MyService
{
	private readonly IUpdateableOptions<MyConfigOptions> _updateableOptions;
	public MyService(IUpdateableOptions<MyConfigOptions> updateableOptions)
	{
		_updateableOptions = updateableOptions;

		// _updateableOptions.Value returns updated information when callback is invoked
		// (information is also updated without registering a callback)
        _updateableOptions.RegisterUpdateNotification((updated) =>
        {
            Console.WriteLine($"Updated Position: {updated}");
            HasReceivedUpdate = true;
        });
	}

	public void UpdateSettings(string newSettingA, int newSettingB)
	{
		// local copy that can be modified
		var options = _updateableOptions.Value;
		
		// Update the settings
		options.SettingA = newSettingA;
		options.SettingB = newSettingB;
		
		// modifications are updated in the underlying storage
		_updateableOptions.Update(options);
	}
}
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.2 196 12/22/2025
0.1.1 155 12/21/2025
0.1.0 156 12/21/2025