Skip to content

chugunov/ManyConfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ManyConfig

NuGet version Build status

A helper package for easy configuration

Usage

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

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:

<appSettings>
  <add key="elasticsearch-connection-string" value="http://127.0.0.1:9200" />
</appSettings>

Then you can use configuration:

ElasticConfig elasticConfiguration = ConfigHandler.Get<ElasticConfig>();

TODO

  • Covering by test

Releases

No releases published

Packages

No packages published

Languages