Albatross.Config
8.0.0-43.main
Prefix Reserved
dotnet add package Albatross.Config --version 8.0.0-43.main
NuGet\Install-Package Albatross.Config -Version 8.0.0-43.main
<PackageReference Include="Albatross.Config" Version="8.0.0-43.main" />
<PackageVersion Include="Albatross.Config" Version="8.0.0-43.main" />
<PackageReference Include="Albatross.Config" />
paket add Albatross.Config --version 8.0.0-43.main
#r "nuget: Albatross.Config, 8.0.0-43.main"
#:package Albatross.Config@8.0.0-43.main
#addin nuget:?package=Albatross.Config&version=8.0.0-43.main&prerelease
#tool nuget:?package=Albatross.Config&version=8.0.0-43.main&prerelease
Albatross.Config
Simplified configuration setup for your .Net applications.
Features
- Use Strong typed configuration class without using the IOptions<> interface.
- Built-In ProgramSetting and EnvironmentSetting config class.
- Built-In endpoints configuration key similar to the connectionStrings key provided by default.
- Validate configuration data using data annotation attributes in the System.DataAnnotation namespace or implement your own validation.
- Custom implementation of IHostEnvironment to save us from changing prod data by accident. See HELP! My developers are also DBAs.
Related Articles
- The Comparison between Albatross.Config and the default IOptions<> Setup
- .Net Hosting Environments
- Use of Environment Variables and Command Line Parameters
Source Code
Documentation
Quick Start
Albatross.Config allows users to create strong typed config classes to manage the configuration data. The config class requires a base class of Albatross.Config.ConfigBase and a constructor with a single parameter of type Microsoft.Extensions.Configuration.IConfiguration.
Here is an example of appsettings.json file and the matching config class.
{
"connectionStrings" : {
"azure-db" : "..."
},
"endpoints": {
"ms-graph" : "..."
},
"my-config" : {
"configData" : "..."
}
}
public class MyConfig : ConfigBase {
public MyConfig(IConfiguration configuration) : base(configuration, "my-config") {
this.MsGraphicEndPoint = configuration.GetRequiredEndPoint("ms-graph");
this.MyConnectionString = configuration.GetRequiredConnectionString("azure-db");
}
[Required]
public string ConfigData { get; }
public string MsGraphicEndPoint { get; }
public string MyConnectionString { get; }
public override void Validate() {
base.Validate();
}
}
If the Key of the config class is defined, the json values of the key in the appsettings.json file will be binded to the config class. The Validate method of the class will be invoked after the creation of its instance. An exception will be thrown if there are any validation errors.
Once the config class is registered using DI, it can be injected directly to classes as a dependency. The AddConfig method by default registers the config class as a Singleton. AddConfig(false) will register the class with a scoped lifetime. The scoped lifetime is useful in the rare case of config data change.
public static IServiceCollection RegisterMyServices(this IServiceCollection services) {
services.AddConfig<MyConfig>();
return services;
}
| Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.Configuration.CommandLine (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Albatross.Config:
| Package | Downloads |
|---|---|
|
Albatross.Hosting
A library for creating .Net Web Api or Service applications with preconfigured settings |
|
|
Albatross.Caching
This assembly contains cache management logic using Polly |
|
|
Albatross.Messaging
A durable messaging library built on top of ZeroMQ |
|
|
Albatross.CommandLine.Defaults
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.0-43.main | 26 | 5/30/2026 |
| 8.0.0-36.main | 27 | 5/27/2026 |
| 7.5.11 | 537 | 12/10/2025 |
| 7.5.10 | 89 | 11/26/2025 |
| 7.5.9 | 285 | 2/27/2025 |
| 7.5.8 | 189 | 11/19/2024 |
| 7.5.7 | 157 | 11/11/2024 |
| 7.5.6 | 132 | 11/8/2024 |
| 7.5.5 | 118 | 11/7/2024 |
| 7.5.4 | 111 | 11/7/2024 |
| 7.4.2 | 149 | 10/8/2024 |
| 7.4.1 | 150 | 10/5/2024 |