Sayer.WebConfig 1.0.0

dotnet add package Sayer.WebConfig --version 1.0.0
NuGet\Install-Package Sayer.WebConfig -Version 1.0.0
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="Sayer.WebConfig" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sayer.WebConfig --version 1.0.0
#r "nuget: Sayer.WebConfig, 1.0.0"
#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 Sayer.WebConfig as a Cake Addin
#addin nuget:?package=Sayer.WebConfig&version=1.0.0

// Install Sayer.WebConfig as a Cake Tool
#tool nuget:?package=Sayer.WebConfig&version=1.0.0

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")

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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.0 327 5/6/2021