Oakrey.Applications.Settings
6.0.0
dotnet add package Oakrey.Applications.Settings --version 6.0.0
NuGet\Install-Package Oakrey.Applications.Settings -Version 6.0.0
<PackageReference Include="Oakrey.Applications.Settings" Version="6.0.0" />
<PackageVersion Include="Oakrey.Applications.Settings" Version="6.0.0" />
<PackageReference Include="Oakrey.Applications.Settings" />
paket add Oakrey.Applications.Settings --version 6.0.0
#r "nuget: Oakrey.Applications.Settings, 6.0.0"
#:package Oakrey.Applications.Settings@6.0.0
#addin nuget:?package=Oakrey.Applications.Settings&version=6.0.0
#tool nuget:?package=Oakrey.Applications.Settings&version=6.0.0
Oakrey.Applications.Settings
WPF-only (.NET 10, Windows) library providing persistent and volatile typed key-value settings backed by JSON, bindable SettingsBase view-model integration, automatic CallerMemberName key inference, built-in window-bounds restore, and a one-call DI registration extension.
Main features
ISettingsService/ISettingsService<T>- typed, generic service for loading, saving and querying settings per settings class.- Persistent and volatile settings - persistent settings survive application restarts; volatile settings are held in memory only for the current session.
SettingsBase- abstract base class deriving fromViewModelBase; combinesISettingsServicewithINotifyPropertyChangedso settings properties bind directly in WPF.CallerMemberNamekey inference -Get<T>()andSet<T>()use the calling property name as the storage key automatically; no magic strings required.RestoreBounds- ready-made settings class that stores and restoresTop,Left,Width,Heightfor aWindow, with sensible minimum-value guards.RestoreBoundExtension-ApplyRestoreBoundsandSaveRestoreBoundsextension methods onSystem.Windows.Window.- JSON backing - settings are serialized to and loaded from JSON via
IJsonSettingService; each settings class occupies its own section keyed by its full type name. - DI registration - single
ConfigureSettingService(IServiceCollection)call registers all required services. - Logging and tracing - integrated with
Oakrey.LogandOakrey.Telemetry.Tracing.
Architecture
classDiagram
class ISettingsService {
+Get~TValue~(key) TValue
+GetVolatile~TValue~(key) TValue
+Set~TValue~(value, key)
+SetVolatile~TValue~(value, key)
+Load()
+Save()
+AppSettingPath string
}
class SettingsService~TSetting~ {
-settingsStorage Dictionary
-volatileSettingsStorage Dictionary
-jsonService IJsonSettingService
}
class SettingsBase {
#Get~TValue~(key) TValue
#Set~TValue~(value, key)
#GetVolatile~TValue~(key) TValue
#SetVolatile~TValue~(value, key)
}
class RestoreBounds {
+Top int
+Left int
+Width int
+Height int
}
ISettingsService <|.. SettingsService~TSetting~
SettingsBase --> ISettingsService
RestoreBounds --|> SettingsBase
Requirements
- .NET 10 Windows (WPF)
- Package references:
Oakrey.Log,Oakrey.ViewModels - Project references (when used from source):
Json,Application,ViewModels
Installation
NuGet Package Manager
- Open the project in Visual Studio.
- Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
- Search for
Oakrey.Applications.Settingsand install.
.NET CLI
dotnet add package Oakrey.Applications.Settings
Package Manager Console
Install-Package Oakrey.Applications.Settings
Configuration
Register all required services with a single call in your DI setup:
services.ConfigureSettingService();
This registers IFileService, IJsonSettingService, and the open-generic ISettingsService<>.
Example usage
Custom settings class
public sealed class AppSettings(ISettingsService<AppSettings> settingsService)
: SettingsBase(settingsService)
{
public string Theme
{
get => Get<string>() ?? "Dark";
set => Set(value);
}
public bool ShowToolbar
{
get => Get<bool>();
set => Set(value);
}
}
Register with DI:
services.ConfigureSettingService();
services.AddTransient<AppSettings>();
Window bounds restore
// In Window.Loaded
window.ApplyRestoreBounds(restoreBounds);
// In Window.Closing
window.SaveRestoreBounds(restoreBounds);
Register RestoreBounds in DI (it is resolved via ISettingsService<RestoreBounds>):
services.ConfigureSettingService();
services.AddTransient<RestoreBounds>();
Development notes
- Settings are stored per type: the full type name of
TSettingis used as the JSON section key. - Default settings are loaded first; user-overrides are merged on top.
SettingsService<T>implementsIDisposable;Dispose()triggers a finalSave().RestoreBoundsenforces a minimum of 100 px for position and 768 px for dimensions.- Volatile settings are not persisted to disk and are cleared on dispose.
Project information
| Field | Value |
|---|---|
| Author | Oakrey |
| License | MIT |
| Target framework | net10.0-windows |
| NuGet package | Oakrey.Applications.Settings |
| Repository | https://dev.azure.com/oakrey/OpenPackages/_git/ApplicationServices |
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.Abstractions (>= 6.0.0)
- Oakrey.Applications.Files.Abstractions (>= 6.0.0)
- Oakrey.Applications.Json (>= 6.0.0)
- Oakrey.Applications.ViewModels (>= 2.0.4)
- Oakrey.Log (>= 2.0.1)
- Oakrey.Telemetry (>= 2.0.1)
- Oakrey.ViewModels (>= 2.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Oakrey.Applications.Settings:
| Package | Downloads |
|---|---|
|
Oakrey.Applications.Base
A foundational .NET library for building modular WPF applications. Provides application lifecycle management, MVVM ViewModel resolution, structured logging, telemetry, and sequential or parallel service preloading with full unhandled-exception coverage. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 104 | 5/22/2026 |
| 5.1.6 | 106 | 5/22/2026 |
| 5.1.5 | 106 | 5/15/2026 |
| 5.1.4 | 132 | 3/13/2026 |
| 5.1.0 | 134 | 2/13/2026 |
| 5.0.1 | 120 | 2/11/2026 |
| 5.0.0 | 438 | 11/18/2025 |
| 4.0.1 | 199 | 10/31/2025 |
| 4.0.0 | 225 | 10/22/2025 |
| 3.3.1 | 188 | 10/10/2025 |
| 3.2.0 | 246 | 9/29/2025 |
| 3.1.0 | 229 | 9/23/2025 |
| 3.0.0 | 226 | 9/8/2025 |
| 2.0.0 | 359 | 6/9/2025 |
| 1.0.0 | 304 | 4/17/2025 |