- Easy to use global application settings
- Realize value changes without app recycle/ restart
- Graceful fallback values if data layer cannot be accessed
Download the latest release.
Install-Package DbAppSettings.DbAppSettings
Visit the Wiki for quick setup guide.
Settings File:
namespace DbAppSettings.MyAssembly
{
public class MyAssemblySettings
{
public class EnableLogging : DbAppSetting<EnableLogging, bool> { public override bool InitialValue => false; }
public class MyOtherSetting : DbAppSetting<MyOtherSetting, SettingsObject> { public override SettingsObject InitialValue => new SettingsObject(); }
}
public class SettingsObject
{
public int PropertyOne => 1;
public string PropertyTwo => "String settings";
}
}
Setting Usage:
public void DoSomeWork()
{
if (MyAssemblySettings.MyOtherSetting.Value.PropertyOne == 1)
{
//Do other work
}
if (MyAssemblySettings.EnableLogging.Value)
{
//Log some statements
}
}