LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings 1.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings --version 1.0.5                
NuGet\Install-Package LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings -Version 1.0.5                
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="LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings --version 1.0.5                
#r "nuget: LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings, 1.0.5"                
#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 LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings as a Cake Addin
#addin nuget:?package=LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings&version=1.0.5

// Install LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings as a Cake Tool
#tool nuget:?package=LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings&version=1.0.5                

LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings

This is a Stakhanovise.NET add-on package that enables configuration via the Microsoft.Extensions.Configuration package, using the json format.

Usage

1. Add namespace references

  • using LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings - root namespace.

2. Registering the defaults provider

await Stakhanovise
	.CreateForTheMotherland(new NetCoreConfigurationStakhanoviseDefaultsProvider())
	.SetupWorkingPeoplesCommittee(setup => 
	{
		//additional setup if needed
	})
	.StartFulfillingFiveYearPlanAsync();

3. Writing the configuration file

The configuration file location

The configuration file is searched by default in the current working directory, as returned by the Directory.GetCurrentDirectory(), using the name appsettings.json. Both of these parameters can be customized when setting up a NetCoreConfigurationStakhanoviseDefaultsProvider instance.

The configuration options parent key

The configuration options are stored under a dedicated key, which by default is Lvd.Stakhanovise.Net.Config, but one may specify a custom key when setting up a NetCoreConfigurationStakhanoviseDefaultsProvider instance.

The configuration options model

The model (structure and types) for the configuration options can be found here. Special notes:

  • the ConnectionStringName option must refer to a valid connection string entry in the file's ConnectionStrings section;
  • the CalculateDelayTicksTaskAfterFailure option is a Func<IQueuedTaskToken, long> and must be specified using plain C# lambda literal code, which will be compiled when the configuration options are read;
  • the IsTaskErrorRecoverable option is a Func<IQueuedTask, Exception, bool> and must be specified using plain C# lambda literal code, which will be compiled when the configuration options are read;
  • the ExecutorAssemblies option, that is, the list of executor assemblies, is processed by loading each entry using Assembly.LoadFrom().

Please see the corresponding test project for a set of sample configuration files.

4. The fallback provider

There is no need to specify all the configuration options in the configuration file. The ones that are missing will be pulled from a fallback provider, which by default is Stakhanovise.NET's built-in ReasonableStakhanoviseDefaultsProvider. One may specify a custom fallback provider when setting up a NetCoreConfigurationStakhanoviseDefaultsProvider instance.

5. Registering additional files

You may use .AddConfigFileName():

new NetCoreConfigurationStakhanoviseDefaultsProvider()
	.AddConfigFileName("appsettings.Production.json");

Or one of the constructors which allows you to specify additional config file names.

Dependencies

  1. Microsoft.CodeAnalysis.CSharp.Scripting;
  2. Microsoft.Extensions.Configuration;
  3. Microsoft.Extensions.Configuration.Binder;
  4. Microsoft.Extensions.Configuration.FileExtensions;
  5. Microsoft.Extensions.Configuration.Json.
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 was computed.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.7 148 10/18/2024
1.0.6 97 10/9/2024
1.0.5 797 3/17/2023
1.0.4 227 3/9/2023
1.0.2 230 3/9/2023

Version sync with core packages