Linger.Configuration
1.6.0
dotnet add package Linger.Configuration --version 1.6.0
NuGet\Install-Package Linger.Configuration -Version 1.6.0
<PackageReference Include="Linger.Configuration" Version="1.6.0" />
<PackageVersion Include="Linger.Configuration" Version="1.6.0" />
<PackageReference Include="Linger.Configuration" />
paket add Linger.Configuration --version 1.6.0
#r "nuget: Linger.Configuration, 1.6.0"
#:package Linger.Configuration@1.6.0
#addin nuget:?package=Linger.Configuration&version=1.6.0
#tool nuget:?package=Linger.Configuration&version=1.6.0
Linger.Configuration
A lightweight configuration helper library for .NET applications.
Upgrading from 1.6 to 2.0? See Preparing for Linger 2.0.
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 | Versions 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. |
-
.NETStandard 2.0
- Linger.Utils (>= 1.6.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.Configuration.Json (>= 10.0.10)
-
net10.0
- Linger.Utils (>= 1.6.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.Configuration.Json (>= 10.0.10)
-
net8.0
- Linger.Utils (>= 1.6.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.Configuration.Json (>= 10.0.10)
-
net9.0
- Linger.Utils (>= 1.6.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.10)
- Microsoft.Extensions.Configuration.Json (>= 10.0.10)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Linger.Configuration:
| Package | Downloads |
|---|---|
|
Linger.Email.AspNetCore
ASP.NET Core integration for Linger.Email. Provides dependency injection, configuration binding, logging, and convenience email service wrappers. |
|
|
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.6.0 | 37 | 7/25/2026 |
| 1.5.5 | 58 | 7/23/2026 |
| 1.5.4-preview | 87 | 7/21/2026 |
| 1.5.3-preview | 120 | 7/20/2026 |
| 1.5.2-preview | 127 | 7/19/2026 |
| 1.5.1-preview | 125 | 7/15/2026 |
| 1.5.0-preview | 119 | 7/14/2026 |
| 1.4.4-preview | 138 | 6/16/2026 |
| 1.4.3-preview | 131 | 6/15/2026 |
| 1.4.2 | 149 | 5/20/2026 |
| 1.4.1-preview | 135 | 5/12/2026 |
| 1.4.0 | 146 | 5/6/2026 |
| 1.3.3-preview | 131 | 5/5/2026 |
| 1.3.2-preview | 139 | 4/29/2026 |
| 1.3.1-preview | 134 | 4/28/2026 |
| 1.3.0-preview | 133 | 4/27/2026 |
| 1.2.0-preview | 151 | 3/29/2026 |
| 1.1.0 | 167 | 2/4/2026 |
| 1.0.3-preview | 157 | 1/9/2026 |
| 1.0.2-preview | 175 | 1/8/2026 |