ToolBX.AutoConfig 2.2.0

dotnet add package ToolBX.AutoConfig --version 2.2.0
NuGet\Install-Package ToolBX.AutoConfig -Version 2.2.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="ToolBX.AutoConfig" Version="2.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToolBX.AutoConfig --version 2.2.0
#r "nuget: ToolBX.AutoConfig, 2.2.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.
// Install ToolBX.AutoConfig as a Cake Addin
#addin nuget:?package=ToolBX.AutoConfig&version=2.2.0

// Install ToolBX.AutoConfig as a Cake Tool
#tool nuget:?package=ToolBX.AutoConfig&version=2.2.0

AutoConfig

AutoConfig

A .NET library to make it easier to use appsettings sections using AutoConfig attributes directly on classes.

How does it work?

You write a configuration type, as you normally would except that you add a [AutoCondig] attribute with a string on top of it.

[AutoConfig("MyConfig")]
public sealed record Configuration
{
    public string Name { get; init; }
    public bool IsAwesome { get; init; }
}

The string is the section name inside your appsettings.json file.

{
    "MyConfig": {
        "name": "Roger",
        "isAwesome": true
    }
}

Getting started

In order for your configuration to be injected as an IOptions<T>, you need to call the following method where you configure your application services :

services.AddAutoConfig(configuration);

Alternatively, you can also specify which assembly to use :

services.AddAutoConfig(Assembly.GetExecutingAssembly(), configuration);

The latter is more performant because the former will look through all your assemblies looking for anything with the [AutoConfig] attribute on it. It is more convenient but it comes at certain a cost. Use the Assembly overload if performance is a concern.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ToolBX.AutoConfig:

Package Downloads
ToolBX.FileGuy

High-level API for handling files.

ToolBX.AssemblyInitializer

Helps decouple initialization logic by splitting it into AssemblyInitializer classes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.0 422 1/11/2024
2.2.0-beta3 153 1/7/2024
2.2.0-beta1 131 7/26/2023