Coder Social home page Coder Social logo

cascadingconfiguration's Introduction

Cascading Configuration Sources

The purpose of this library is to enable an application to rapidly specify 1 or numerous configuration sources, allowing for debugging, overriding values, performing in place hotfixes, and many many more uses.

There are three levels that users of this library should concern themselves with:

  • Config: This object is created by the user of the library. It should inherit from IConfig.

  • ConfigSource: This object specifies exactly how the aforementioned Config gets its values. Several sources are defined out of the box such as:

    • IDbConfigSource: This class can be extended to allow for easy access to config values kept in a database. You might specify a Dictionary<string(PropertyName),string(SqlString)> wherein each property is populated by the accompanying SQL string.

      • KvpDbConfigSource: Populates your specified config with values from the a dbo.table where the values are all in the same column and identified by their property name in the database.

      • SingleRecordDbConfigSource: Populates your specified config with values are all all sourced from a single record in a database. The property values in your config should have names which match the columns in the table you are sourcing from.

    • AppConfigSource Mostly in place to allow for you to place values sourced using the Configuration Manager to be placed within the Hierarchy of Cascading Configuration Sources. The keys specified in the .config file should match the name of the properties in your Config class.

    • TextFileConfigSource Works very similarly to AppConfigSource in that it matches on key-value pairs where the properties match the keys specified in the .txt file. It sources these keys the text file provided during the construction of this object.

  • ConfigProvider: This object holds a sorted HashSet of the ConfigSources you've specified. Iterating over the sources to populate the user specified IConfig object.

This object wraps the config file you've specified. Providing utility methods to the ConfigSources for setting and converting properties in the IConfig object. You specify the source such as other objects in memory, remote resources pulled via http requests, yaml files, etc.

Call typeOf(Config).GetProperties to retrieve the properties specified in your custom type. Then call Config.Provider.SetProperty(property, value) for each.

This object also has some properties of its own:

  • Cascade: This property, when true, will allow for iterating over multiple ConfigSources. Starting with the lowest priority objects and moving progressively higher. The result being that values from higher priority sources overwriting that of lower priority sources.

Further description to come....

cascadingconfiguration's People

Contributors

imbaker1234 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.