Skip to content

mmohoney/DbAppSettings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DbAppSettings

Build Status

Features

  • Easy to use global application settings
  • Realize value changes without app recycle/ restart
  • Graceful fallback values if data layer cannot be accessed

Download

Download the latest release.

Get it on NuGet

Install-Package DbAppSettings.DbAppSettings

Documentation/ Release Notes

Visit the Wiki for quick setup guide.

Example

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
    }
}