Twileloop.ExpressSettings 1.0.0

Prefix Reserved
Additional Details

This package is no more maintained by the Author. Visit https://packages.twileloop.com/ for new packages

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

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

Express-Settings

Express settings allows you to create very quick persistent settings in your .NET core app

Express settings allows you quick prototyping of applications that relies on fetching configurations from settings file. Express settings is seamless to integrate and requires merely 1 line to read or write settings. It creates readable intended JSON based settings and can be called from anywhere your application.

Create Your Settings Object

Create your settings class with the whatever properties you want to persist

NOTE: Make sure you have a constructor on your settings class that initialises to the default settings value. The library will create a defaut instance of settings from the constructor if it can't find an already persisted settings.

public class MySettings 
{
  public bool EnableApp {get; set;}
  public List < string > Blocklists {get; set;}
  public string URL {get; set;}
  public Debugging Debug {get; set;}

  //Initlaise default settings values
  public MySettings() {
    EnableApp = true;
    Blocklists = new List < string > ();
    URL = "https://default.com";
    Debug = new Debugging();
  }
}


public class Debugging 
{
  public bool EnableVerboseLogging {get; set;}
  public bool EnableTestMode {get; set;}

  //Initlaise default settings values
  public Debugging() {
    EnableTestMode = false;
    EnableVerboseLogging = true;
  }
}

Read/Write Settings Anywhere

Once you have your settings model class, Simply call the ExpressSettings to read or write your settings at valid points on your application. No complexities.

//Read settings (this will return a default instance of 'MySettings' if no persisted settings available)
var settings = Settings<MySettings>.Read();
//Your settings
var settings = new MySettings 
{
  EnableApp = true,
  Blocklists = new List <string> {"List A","List B", "List C", "List D"}, 
  URL = url.Text,
  Debug = new Debugging 
  {
    EnableTestMode = false,
    EnableVerboseLogging = true
  }
};

//Write settings
Settings<MySettings>.Write(settings);
Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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 597 9/12/2020 1.0.0 is deprecated because it is no longer maintained.

Supports ejecting default instance of settings if no persistence available while read