ExistForAll.SimpleSettings.Extensions.GenericHost 2.0.0

dotnet add package ExistForAll.SimpleSettings.Extensions.GenericHost --version 2.0.0
                    
NuGet\Install-Package ExistForAll.SimpleSettings.Extensions.GenericHost -Version 2.0.0
                    
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="ExistForAll.SimpleSettings.Extensions.GenericHost" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExistForAll.SimpleSettings.Extensions.GenericHost" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ExistForAll.SimpleSettings.Extensions.GenericHost" />
                    
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 ExistForAll.SimpleSettings.Extensions.GenericHost --version 2.0.0
                    
#r "nuget: ExistForAll.SimpleSettings.Extensions.GenericHost, 2.0.0"
                    
#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 ExistForAll.SimpleSettings.Extensions.GenericHost@2.0.0
                    
#: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=ExistForAll.SimpleSettings.Extensions.GenericHost&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ExistForAll.SimpleSettings.Extensions.GenericHost&version=2.0.0
                    
Install as a Cake Tool

<img src="https://raw.githubusercontent.com/existall/SimpleSettings/master/icon.png" alt="ExistForAll.SimpleSettings">

ExistForAll.SimpleSettings

Strongly-typed application settings for .NET. Declare a plain public interface, decorate it with defaults, and SimpleSettings binds your configuration into a runtime implementation you can inject anywhere — no concrete option classes, no per-type services.Configure<> wiring.

Installation

dotnet add package ExistForAll.SimpleSettings
dotnet add package ExistForAll.SimpleSettings.Binders
dotnet add package ExistForAll.SimpleSettings.Extensions.GenericHost
  • ExistForAll.SimpleSettings — the core binding engine and the direct SettingsBuilder API.
  • ExistForAll.SimpleSettings.Binders — additional binders (in-memory, command-line, and more).
  • ExistForAll.SimpleSettings.Extensions.GenericHost — dependency-injection integration (AddSimpleSettings).

Table of Content

  1. Getting started
  2. Building the collection
  3. Building config interfaces
  4. Default Values
  5. Build section binders
  6. Extending SimpleSettings
  7. Security & Behavior

Why SimpleSettings

.NET ships IOptions<>, but it couples your application to a framework abstraction, forces every settings shape to be a concrete class rather than an interface, and requires a manual services.Configure<> call per type. SimpleSettings keeps the positioning of IOptions<> — configuration bound into typed objects — while letting you depend on a plain interface, discovered and bound automatically, and portable across DI containers. You inject the interface; SimpleSettings supplies the implementation.

Quickstart

Declare a settings interface and bind it with the direct API:

[SettingsSection]
public interface IEmailSenderSettings
{
    [SettingsProperty(DefaultValue = "https://smtp.example.com")]
    string ServiceUrl { get; set; }

    [SettingsProperty(DefaultValue = 3)]
    int Retries { get; set; }
}

var settings = SettingsBuilder.CreateBuilder()
    .GetSettings<IEmailSenderSettings>();

Every settings interface must be public — SimpleSettings emits a runtime implementation of the interface and cannot implement a non-public one.

Feature overview

  • Bind configuration into public settings interfaces — no concrete option classes.
  • Discover settings via [SettingsSection], the ISettingsSection marker base, or a Settings name suffix.
  • Per-property defaults, key overrides, custom converters, and required-value enforcement via [SettingsProperty(...)].
  • Object-level and per-property validation through ISettingValidation<T>.
  • First-class dependency-injection integration for the .NET Generic Host.
  • Value-free exceptions on bind and conversion failures — bound values never surface in error messages (see Security & Behavior).

Dependency injection

Register SimpleSettings with the Generic Host and let it discover every settings interface in the supplied assemblies:

services.AddSimpleSettings(o =>
{
    o.AddAssemblies(new[] { typeof(IEmailSenderSettings).Assembly });
});

// after building the provider — opt-in, deferred DI validation:
serviceProvider.ValidateSimpleSettings();

ValidateSimpleSettings() extends IServiceProvider and must be called after BuildServiceProvider(); attribute and ValidatorType validators run inline during binding and need no such call. See Security & Behavior for the full validation model.

Security notes

Every exception SimpleSettings throws on a bind or conversion failure is value-free: it carries only type and property metadata and never chains an inner exception that saw the bound value, so a secret you bound cannot surface in the error's ToString() chain. This is a structural guarantee, not a convention.

There are two carve-outs the guard does not reach, and you own them: author-supplied ValidationError message text (it is emitted verbatim), and DI-resolved validator constructors (they run outside the value-free bind guard). Never echo a bound value into a validation message and never log a secret in a validator constructor. See Security & Behavior for the full treatment.

Breaking changes / migration (v1 → v2)

The v1 → v2 release batched four breaking changes:

  • SettingsHolder / ISettingsHolder are now internal — use the public SettingsBuilder / ISettingsCollection / ISettingsProvider surface instead.
  • The Core.AspNet package was dropped — it exposed no public type; remove any reference to it.
  • The Microsoft.Extensions.* dependency floor is now per-TFM8.0.x on net8.0, current on net10.0.
  • A public abstract SimpleSettingsException base was introduced and boundary exceptions were made public and structured; the old bare-Exception throw for a non-interface settings type is now SettingsTypeNotInterfaceException.

See the full migration guide in docs/Security.md.

Product 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. 
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
2.0.0 115 7/20/2026
2.0.0-alpha.0.140 64 7/20/2026
2.0.0-alpha.0.139 61 7/19/2026
2.0.0-alpha.0.138 55 7/15/2026
2.0.0-alpha.0.137 58 7/15/2026
2.0.0-alpha.0.136 57 7/14/2026
2.0.0-alpha.0.135 58 7/14/2026
2.0.0-alpha.0.134 62 7/14/2026
2.0.0-alpha.0.133 57 7/14/2026
2.0.0-alpha.0.132 69 7/14/2026
2.0.0-alpha.0.131 64 7/14/2026
2.0.0-alpha.0.130 63 7/13/2026
2.0.0-alpha.0.129 55 7/13/2026
2.0.0-alpha.0.128 57 7/13/2026
2.0.0-alpha.0.127 60 7/13/2026
2.0.0-alpha.0.126 63 7/13/2026
2.0.0-alpha.0.125 55 7/12/2026
2.0.0-alpha.0.124 51 7/12/2026
2.0.0-alpha.0.123 65 7/12/2026
2.0.0-alpha.0.122 62 7/12/2026
Loading failed