Linger.Configuration
0.7.2
See the version list below for details.
dotnet add package Linger.Configuration --version 0.7.2
NuGet\Install-Package Linger.Configuration -Version 0.7.2
<PackageReference Include="Linger.Configuration" Version="0.7.2" />
<PackageVersion Include="Linger.Configuration" Version="0.7.2" />
<PackageReference Include="Linger.Configuration" />
paket add Linger.Configuration --version 0.7.2
#r "nuget: Linger.Configuration, 0.7.2"
#:package Linger.Configuration@0.7.2
#addin nuget:?package=Linger.Configuration&version=0.7.2
#tool nuget:?package=Linger.Configuration&version=0.7.2
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 | 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 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. |
.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 (>= 0.7.2)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.Configuration.Json (>= 9.0.5)
-
net8.0
- Linger.Utils (>= 0.7.2)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.Configuration.Json (>= 9.0.5)
-
net9.0
- Linger.Utils (>= 0.7.2)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.5)
- Microsoft.Extensions.Configuration.Json (>= 9.0.5)
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 |
---|---|---|
0.8.0-preview | 484 | 7/22/2025 |
0.7.2 | 153 | 6/3/2025 |
0.7.1 | 159 | 5/21/2025 |
0.7.0 | 156 | 5/19/2025 |
0.6.0-alpha | 162 | 4/28/2025 |
0.5.0-alpha | 162 | 4/10/2025 |
0.4.0-alpha | 159 | 4/1/2025 |
0.3.3-alpha | 156 | 3/19/2025 |
0.3.2-alpha | 153 | 3/17/2025 |
0.3.1-alpha | 141 | 3/16/2025 |
0.3.0-alpha | 203 | 3/6/2025 |
0.2.0-alpha | 101 | 2/9/2025 |
0.1.2-alpha | 105 | 12/17/2024 |
0.1.1-alpha | 101 | 12/17/2024 |
0.1.0-alpha | 105 | 12/6/2024 |
0.0.3-alpha | 128 | 8/9/2024 |
0.0.2-alpha | 103 | 8/9/2024 |
0.0.1-alpha | 91 | 8/7/2024 |