Skip to content

medxchange/sharp-settings-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SharpSettingsStore

A very simple low-friction approach to persisting settings.

SharpSettingsStore

Example

Settings definition:

[SettingName("my-settings")]
public class MySettings
{
    public MySettings()
    {
        MyString = "default";
        MyInt = 30;
    }
    
    public string MyString { get; set; }
    
    public int MyInt { get; set; }
}

Usage:

ISettingsService settingsService = /**/;

// Method 1
var settings = await settingsService.GetSetting<MySettings>();
settings.MyInt = 45;
settings.MyString = "updated";
await settingsService.SaveSetting(settings);

// Method 2
await settingsService.SaveSetting<MySettings>(x =>
{
    x.MyInt = 45;
    x.MyString = "updated";
});

About

A simple approach for persisted settings.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.0%
  • Shell 1.0%