Linger.Configuration 1.0.0

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

Linger.Configuration

A lightweight configuration helper library for .NET applications.

Overview

Linger.Configuration provides utilities and extensions to simplify configuration management in .NET applications. It offers a consistent approach to access and bind configuration settings from various sources, with a focus on strongly-typed configuration.

Features

  • Simple singleton-based configuration access
  • Strong typing for configuration settings
  • Extension methods for IConfiguration
  • Support for JSON configuration files
  • Compatible with dependency injection
  • Cross-platform support

Installation

dotnet add package Linger.Configuration

Usage

Basic Usage

// Access configuration singleton
var config = AppConfig.Instance.Config;

// Get configuration values
string connectionString = config.GetConnectionString("DefaultConnection");
int timeoutSeconds = config.GetValue<int>("AppSettings:TimeoutSeconds");

// Bind to strongly-typed objects
var smtpSettings = config.GetSection("SmtpSettings").Get<SmtpSettings>();

Strongly-typed Configuration

public class AppSettings
{
    public string ApplicationName { get; set; }
    public int CacheTimeoutMinutes { get; set; }
    public bool EnableLogging { get; set; }
    public ConnectionStrings ConnectionStrings { get; set; }
}

public class ConnectionStrings
{
    public string DefaultConnection { get; set; }
    public string LoggingConnection { get; set; }
}

// Bind configuration
var appSettings = config.Get<AppSettings>();
Console.WriteLine($"App Name: {appSettings.ApplicationName}");
Console.WriteLine($"Cache Timeout: {appSettings.CacheTimeoutMinutes} minutes");

Using with Dependency Injection

// In Startup.cs or Program.cs
public void ConfigureServices(IServiceCollection services)
{
    // Add configuration
    services.AddSingleton<IConfiguration>(AppConfig.Instance.Config);
    
    // Register strongly-typed options
    services.Configure<AppSettings>(Configuration.GetSection("AppSettings"));
    
    // Use options pattern
    services.AddTransient<IMyService, MyService>();
}

// In a service
public class MyService : IMyService
{
    private readonly AppSettings _settings;
    
    public MyService(IOptions<AppSettings> options)
    {
        _settings = options.Value;
    }
    
    public void DoSomething()
    {
        // Use settings
        if (_settings.EnableLogging)
        {
            // Log something
        }
    }
}

Helper Methods

// Get a typed value with a default
int timeout = AppSettingsHelper.GetValue("TimeoutSeconds", 30);

// Get a connection string
string connStr = AppSettingsHelper.GetConnectionString("DefaultConnection");

// Get a complex configuration object
var emailSettings = AppSettingsHelper.GetSection<EmailSettings>("EmailConfiguration");

Dependencies

  • Microsoft.Extensions.Configuration.Binder
  • Microsoft.Extensions.Configuration.Json
  • Linger (Core utilities)

License

This project is licensed under the terms of the license provided with the Linger project.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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 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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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 Linger.Configuration:

Package Downloads
Linger.Email.AspNetCore

ASP.NET Core integration for the Linger.Email library. Provides dependency injection extensions and configuration integration for email services. Simplifies email sending in modern ASP.NET Core applications.

Linger.AspNetCore.Jwt

A comprehensive JWT authentication implementation for ASP.NET Core applications. Provides JWT token generation, validation, and refresh token functionality with blacklisting support. Integrates seamlessly with ASP.NET Core authentication services.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 334 11/12/2025
1.0.0-preview2 136 11/6/2025
1.0.0-preview1 140 11/5/2025
0.9.9 122 10/16/2025
0.9.8 129 10/14/2025
0.9.7-preview 124 10/13/2025
0.9.6-preview 105 10/12/2025
0.9.5 111 9/28/2025
0.9.4-preview 133 9/25/2025
0.9.3-preview 155 9/22/2025
0.9.1-preview 260 9/16/2025
0.9.0-preview 87 9/12/2025
0.8.5-preview 216 8/31/2025
0.8.4-preview 337 8/25/2025
0.8.3-preview 195 8/20/2025
0.8.2-preview 217 8/4/2025
0.8.1-preview 163 7/30/2025
0.8.0-preview 564 7/22/2025
0.7.2 204 6/3/2025
0.7.1 208 5/21/2025
0.7.0 208 5/19/2025
0.6.0-alpha 215 4/28/2025
0.5.0-alpha 212 4/10/2025
0.4.0-alpha 202 4/1/2025
0.3.3-alpha 190 3/19/2025
0.3.2-alpha 194 3/17/2025
0.3.1-alpha 186 3/16/2025
0.3.0-alpha 246 3/6/2025
0.2.0-alpha 141 2/9/2025
0.1.2-alpha 146 12/17/2024
0.1.1-alpha 151 12/17/2024
0.1.0-alpha 145 12/6/2024
0.0.3-alpha 180 8/9/2024
0.0.2-alpha 136 8/9/2024
0.0.1-alpha 131 8/7/2024