LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings
1.0.5
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
<PackageReference Include="LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings" Version="1.0.5" />
paket add LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings --version 1.0.5
#r "nuget: LVD.Stakhanovise.NET.NetCoreConfigurationExtensionsBindings, 1.0.5"
// 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'sConnectionStrings
section; - the
CalculateDelayTicksTaskAfterFailure
option is aFunc<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 aFunc<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 usingAssembly.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
Microsoft.CodeAnalysis.CSharp.Scripting
;Microsoft.Extensions.Configuration
;Microsoft.Extensions.Configuration.Binder
;Microsoft.Extensions.Configuration.FileExtensions
;Microsoft.Extensions.Configuration.Json
.
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 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. |
-
.NETStandard 2.1
- LVD.Stakhanovise.NET (>= 1.0.5)
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.4.0)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.2)
- Microsoft.Extensions.Configuration.FileExtensions (>= 7.0.0)
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version sync with core packages