Albatross.Config 7.5.8

Prefix Reserved
This package has a SemVer 2.0.0 package version: 7.5.8+8e7c52c.
dotnet add package Albatross.Config --version 7.5.8                
NuGet\Install-Package Albatross.Config -Version 7.5.8                
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="Albatross.Config" Version="7.5.8" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Albatross.Config --version 7.5.8                
#r "nuget: Albatross.Config, 7.5.8"                
#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.
// Install Albatross.Config as a Cake Addin
#addin nuget:?package=Albatross.Config&version=7.5.8

// Install Albatross.Config as a Cake Tool
#tool nuget:?package=Albatross.Config&version=7.5.8                

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.

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) {
		this.MsGraphicEndPoint = configuration.GetRequiredEndPoint("ms-graph");
		this.MyConnectionString = configuration.GetRequiredConnectionString("azure-db");
	}
	public override Key => "my-config";
	[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 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. 
.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 (9)

Showing the top 5 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.Hosting.Utility

Wrapper api to create a command line utility using CommandLineParser with dependency injection and serilog logging support.

Albatross.Hosting.Test

hosting framework for test projects

Albatross.CommandLine

An integration library that simplifies the creation of console program using the [System.CommandLine](https://learn.microsoft.com/en-us/dotnet/standard/commandline/) library

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.5.8 34 11/19/2024
7.5.7 53 11/11/2024
7.5.6 40 11/8/2024
7.5.5 39 11/7/2024
7.5.4 29 11/7/2024
7.4.2 69 10/8/2024
7.4.1 64 10/5/2024
6.1.1 463 9/18/2023
4.0.2 1,110 10/18/2022
2.8.0 921 8/11/2021
2.3.6 817 2/23/2021
1.6.8 1,016 1/8/2021
1.6.7 3,579 9/24/2020
1.6.6 2,041 8/21/2020
1.6.2 879 8/5/2020
1.6.1 673 7/30/2020
1.6.0 1,618 7/27/2020
1.5.33 1,490 7/9/2020