ToolBX.AutoConfig 3.0.0-beta1

This is a prerelease version of ToolBX.AutoConfig.
There is a newer version of this package available.
See the version list below for details.
dotnet add package ToolBX.AutoConfig --version 3.0.0-beta1
                    
NuGet\Install-Package ToolBX.AutoConfig -Version 3.0.0-beta1
                    
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="3.0.0-beta1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ToolBX.AutoConfig" Version="3.0.0-beta1" />
                    
Directory.Packages.props
<PackageReference Include="ToolBX.AutoConfig" />
                    
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 ToolBX.AutoConfig --version 3.0.0-beta1
                    
#r "nuget: ToolBX.AutoConfig, 3.0.0-beta1"
                    
#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.
#addin nuget:?package=ToolBX.AutoConfig&version=3.0.0-beta1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=ToolBX.AutoConfig&version=3.0.0-beta1&prerelease
                    
Install as a Cake Tool

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 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 was computed.  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 (3)

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

Package Downloads
ToolBX.AssemblyInitializer

Helps decouple initialization logic by splitting it into AssemblyInitializer classes.

ToolBX.MisterTerminal

A high level library to easily and cleanly build smarter console applications.

ToolBX.FileGuy

High-level API for handling files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0 1,979 9/26/2024
3.0.0-beta1 187 9/23/2024
2.2.0 1,101 1/11/2024
2.2.0-beta3 282 1/7/2024
2.2.0-beta1 223 7/26/2023