An open API service indexing awesome lists of open source software.

https://github.com/chugunov/manyconfig

Helper package for easy configuration.
https://github.com/chugunov/manyconfig

appsettings c-sharp config configuration easy

Last synced: about 1 year ago
JSON representation

Helper package for easy configuration.

Awesome Lists containing this project

README

          

# ManyConfig

[![NuGet version](https://badge.fury.io/nu/manyconfig.svg)](https://badge.fury.io/nu/manyconfig)
[![Build status](https://ci.appveyor.com/api/projects/status/yy63ivdnny35ra01?svg=true)](https://ci.appveyor.com/project/chugunov/manyconfig)

A helper package for easy configuration

## Usage

Add `ManyConfig` attribute to your configuration properties and specify DefaultValue for them.

```csharp
public class ElasticConfig
{
[ManyConfig(Key = "elasticsearch-connection-string",
DefaultValue = "http://localhost:9200")]
public string ConnectionString { get; set; }

[ManyConfig(Key = "elasticsearch-index",
DefaultValue = "comments")]
public string IndexName { get; set; }
}
```

In `app.config` you can override your DefaultValue property by `Key` field:

```xml

```

Then you can use configuration:

```csharp
ElasticConfig elasticConfiguration = ConfigHandler.Get();
```
## TODO

* Covering by test