Git Product home page Git Product logo

customconfigurations's Introduction

Custom Configurations:

Allows the application to simplify the use of configuration settings.  For example if the app has multiple clients settings to be recorded a section for each can be defined and the values seperated out.  The config class allows easy access to a clients configuration and deals with the configuration hooking up in the background for you.

At this point it is not possible to save back to the configuration file.  I have tried to get this to work across the board but failed misserably, will try to tackle this again at a later stage, (there are a few commented out sections and tests aimed at this in the committed code).

Here is an example configuration file:

<configuration>
  <configSections>
    <section name="testsection2" type="CustomConfigurations.ConfigurationSectionLoader, CustomConfigurations" />
    <sectionGroup name="myCustomGroup">
      <section name="mysection" type="CustomConfigurations.ConfigurationSectionLoader, CustomConfigurations" />
    </sectionGroup>
  </configSections>

  <myCustomGroup>
    <mysection>
      <Configs>
      <ConfigurationGroup name="client1">
        <ValueItems>
          <ValueItem key="key2" value="value2" />
          <ValueItem key="key3" value="value3" />
          <ValueItem key="key4" value="value4" />
          <ValueItem key="key5" value="7" />
          <ValueItem key="key6" value="0.6" />        
      </ConfigurationGroup>
	  <ConfigurationGroup name="client2">
          <ValueItems>
            <ValueItem key="keya" value="abc" />
            <ValueItem key="key2" value="123" />
          </ValueItems>
        </ConfigurationGroup>
      </Configs>
    </mysection>
  </myCustomGroup>

  <testsection2>
    <Configs>
      <ConfigurationGroup name="clienta">
        <ValueItems>
          <ValueItem key="key2" value="valueabc" />          
        </ValueItems>       
      </ConfigurationGroup>
    </Configs>
  </testsection2>
</configuration>

If the app wanted to read "client2"'s configuration it could do the following:

CustomConfigurations.Config Configloader = new CustomConfigurations.Config("client2");

To access a value it would use the index of the key:

string myVal = Configloader["keya"];

-------------------------------------------------------------

The console application "ExampleApp" shows the different ways the customConfiguration application can be used.

-------------------------------------------------------------

N.B. all config sections are case sensitive, be careful how you write the xml and using the selectors.

customconfigurations's People

Contributors

twistedtwig avatar

Stargazers

olcay seker avatar

Watchers

olcay seker avatar James Cloos 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.