Sayer.Config
1.0.1
dotnet add package Sayer.Config --version 1.0.1
NuGet\Install-Package Sayer.Config -Version 1.0.1
<PackageReference Include="Sayer.Config" Version="1.0.1" />
paket add Sayer.Config --version 1.0.1
#r "nuget: Sayer.Config, 1.0.1"
// Install Sayer.Config as a Cake Addin #addin nuget:?package=Sayer.Config&version=1.0.1 // Install Sayer.Config as a Cake Tool #tool nuget:?package=Sayer.Config&version=1.0.1
Class for retrieving settings from app.config, optionally related to a type. A separate project exits for web.config files.
Below is an example for a config file, which assumes the existence of class Base, as well as classes Buggy and Stable, which inherit from Base (all in the same assembly). In the example, type Buggy has log level Debug, Stable has level Error, and all other derivatives of Base have level Warn. Classes not inheriting from Base have level Info. All types have Timestamp set to true in the example.
<configuration>
<configSections>
<section name = "logSection" type="Sayer.Config.ConfigSection,Sayer.Config"/>
</configSections>
<logSection>
<field name="LogLevel" value="Info"/>
<field name="Base.LogLevel" value="Warn"/>
<field name="Base.Buggy.LogLevel" value="Debug"/>
<field name="Base.Stable.LogLevel" value="Error"/>
<field name="Timestamp" value="true"/>
</logSection>
<configuration/>
The following statement, given the .config settings below, would return the value Debug:
AppSettings.Get<LogLevel>("logSection", typeof(Buggy), "LogLevel");
The following statement would return the value Info:
AppSettings.Get<LogLevel>("logSection", "LogLevel");
And the following statement would return true:
AppSettings.Get<bool>("logSection", typeof(MyClass), "Timestamp")
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 | 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
- System.Configuration.ConfigurationManager (>= 5.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Sayer.Config:
Package | Downloads |
---|---|
Sayer.WebConfig
Class for retrieving settings from web.config, optionally related to a type. A separate project exists for app.config files. Below is an example for a config file, which assumes the existence of class Base, as well as classes Buggy and Stable, which inherit from Base (all in the same assembly). In the example, type Buggy has log level Debug, Stable has level Error, and all other derivatives of Base have level Warn. Classes not inheriting from Base have level Info. All types have Timestamp set to true in the example. <configuration> <configSections> <section name = "logSection" type="Sayer.Config.ConfigSection"/> </configSections> <logSection> <field name="LogLevel" value="Info"/> <field name="Base.LogLevel" value="Warn"/> <field name="Base.Buggy.LogLevel" value="Debug"/> <field name="Base.Stable.LogLevel" value="Error"/> <field name="Timestamp" value="true"/> </logSection> <configuration/> The following statement, given the .config settings below, would return the value Debug: WebAppSettings.Get<LogLevel>("logSection", typeof(Buggy), "LogLevel"); The following statement would return the value Info: WebAppSettings.Get<LogLevel>("logSection", "LogLevel"); And the following statement would return true: WebAppSettings.Get<bool>("logSection", typeof(MyClass), "Timestamp") |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.1 | 348 | 5/6/2021 |