Click here to Skip to main content
13,048,584 members (93,733 online)
Click here to Skip to main content
Add your own
alternative version


2 bookmarked
Posted 19 Apr 2013

Cinchoo - ConfigurationManager Tips 1

, 21 Apr 2013
Rate this:
Please Sign up or sign in to vote.
This tip shows how to attach configuration files to your applications


Cinchoo is the application framework for .NET. One of the main functionalities that it provides to the users is application configuration management. Application configuration is the information that the application reads and/or writes at run-time from the source. Please take a look at 'Cinchoo - Simplified Configuration Manager' jump start article on using configuration framework in your application.

In this section, I'll talk about a way to hook up the existing configuration files to your files through application configuration file. And how to set environment specific configuration files to the applications.

Using Existing Configuration Files

If you have existing configuration files or you want to share the configuration files with multiple applications, you can do so by specifying the folder path in the application configuration file (App.config) as below:

<?xml version="1.0" encoding="utf-8" ?>
        <section name="appFrxSettings" type="Cinchoo.Core.ChoAppFrxSettings, Cinchoo.Core" />
    <appFrxSettings appFrxFilePath="C:\ConfigFolder" 

	sharedEnvironmentConfigFilePath="" appEnvironment="" />

As you probably know, it is custom configuration section 'Cinchoo.Core.ChoAppFrxSettings' defined in App.config file.

  • appFrxFilePath - Optional. Absolute path to the configuration files directory to use by your application. If not given, 'Config' folder will be created under executable directory.
  • sharedEnvironmentConfigFilePath - Optional. Absolute/relative file path of shared environment configuration file. If not passed, your applications will not be using any environment specific configuration files.
  • appEnvironment - Optional. Environment name, the application will pick up the configuration files tied to the environment. If not specified, will pickup the configuration files tied to the machine from environment configuration file.

Shared Environment

In a situation, where you want to keep and maintain configuration files for each environment (DEV, UAT and PROD, etc.) separately in a centralized location and have them discovered and attached to your application automatically, all of them can be done through Shared Environment Configuration file.

Normally Cinchoo framework discovers this file (SharedEnvironment.config) in the application configuration folder if not specified explicitly. It can be overridden to different file path through 'sharedEnvironmentConfigFilePath' attribute in the above section in App.config file.

Specification of the SharedEnvironment configuration file is as below:

<?xml version="1.0"?>
  <sharedEnvironment defaultEnvironment="DEV">
    <environment name="DEV" appFrxFilePath="Config\DEV" freeze="true" > 
    <environment name="PROD" appFrxFilePath="C:\Config\PROD" freeze="true" >
    <environment name="UAT" >

Each environment can be given with 'environment' section with 'name' attribute, aka environment name. Group of machines can be associated with environment through 'machine' elements. Wild card values may be accepted as machine names. Machine names can be IP addresses or readable machine names.

An environment may be frozen (locked) by specifying 'freeze' tag to true. It means that the application environment is locked for those machines. Your applications running on those machines can NOT be overridden the environment through 'appEnvironment' attribute in the ChoAppFrxSettings section in the App.config file.

Path to configuration files for each environment can be given through 'appFrxFilePath' attribute. It can be either absolute or relative file path to a folder.

Any machines not configured/specified in this shared environment file will pick up the configuration files that belong to environment specified in 'defaultEnvironment' attribute in 'sharedEnvironment' section.

That's all folks. Try for yourself.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 21 Apr 2013
Article Copyright 2013 by Cinchoo
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid