Skip to content

Source of configurations in JSON format with the ability to edit values directly from the running application. Based on Microsoft.Extensions.Configuration.

License

Notifications You must be signed in to change notification settings

Kibnet/WritableJsonConfiguration

Repository files navigation

WritableJsonConfiguration

JSON

GitHub last commit GitHub code size in bytes

GitHub search hit counter Nuget

What is it?

If you want to add a settings to your app and you like json, then this is what you need. This uses the standard interface for working with settings, which is provided by Microsoft.Extensions.Configuration. To do this, we added methods for changing values in settings via the standard interface, which will edit the json file themselves.

How to use?

Add Nuget Package in your project:

Install-Package WritableJsonConfiguration

Create configuration:

IConfigurationRoot configuration = WritableJsonConfigurationFabric.Create("Settings.json");

Use this configuration in the app as you need, usually people register it with the IoC, example(Splat):

Locator.CurrentMutable.RegisterConstant(configuration, typeof(IConfiguration));

Get value:

Themes theme = configuration.GetSection("Appearance:Theme").Get<Themes>();

or

Themes theme = configuration.Get<Themes>("Appearance:Theme");

Set value:

configuration.GetSection("Appearance:Theme").Set(theme);

or

configuration.Set("Appearance:Theme", theme);

Communication

Any suggestions and comments are welcome. If you want to contact me, use Telegram

About

Source of configurations in JSON format with the ability to edit values directly from the running application. Based on Microsoft.Extensions.Configuration.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Languages