Skip to content

Convention-based automagical C# .config to object mapper

License

Notifications You must be signed in to change notification settings

tuga1975/Nerdle.AutoConfig

 
 

Repository files navigation

Nerdle.AutoConfig

Build Status Nuget

##Quickstart

Install via NuGet

Install-Package Nerdle.AutoConfig

Define an interface for your configuration settings (no concrete class is required)

public interface IMyServiceConfiguration
{
    string Endpoint { get; }
    int Port { get; }
    bool UseSSL { get; }
}

Add a configuration section in app.config / web.config

<configuration>
  
  <configSections>
    <section name="myService" type="Nerdle.AutoConfig.Section, Nerdle.AutoConfig" />
  </configSections>
  
  <myService endpoint="http://localhost" port="42" useSSL="true" />

</configuration>

Call AutoConfig

var config = AutoConfig.Map<IMyServiceConfiguration>();

You're done!

👍

AutoConfig is a fully customisable and extensible library that can map simple types, strings, enums, nullables, enumerables, collections, lists, arrays, dictionaries, and arbitrarily complex nested types by convention out of the box - no boilerplate required.

Check the wiki for fun times!

About

Convention-based automagical C# .config to object mapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%