Cinchoo – Controlling configuration outputs

In this section I’ll be depicting approach to control the Cinchoo configuration manager output files. There are situation you may want to enable / disable framework’s configuration files, meta data configuration files, application configuration files etc. Here is how you can do via executable configuration file (app.config/web.config) as below

<?xml version="1.0" encoding="utf-8"?>
        <section name="appFrxSettings" type="Cinchoo.Core.ChoAppFrxSettings, Cinchoo.Core" />
    <appFrxSettings appEnvironment="" sharedEnvironmentConfigFilePath=""
        appFrxFilePath="" doNotShowEnvSelectionWnd="false" applicationHostType=""
        disableFrxConfig="false" disableAppConfig="false" disableMetaDataConfig="false" />

Define appFrxSettings configuration section as above in your main executable configuration file (app.config/web.config). Cinchoo framework will create this section with default values if not found at the first run.  In here, the attributes to look into are

  • disableFrxConfig – true, will stop creating framework configuration files. Default value is false.
  • disableMetaDataConfig – true, will stop creating framework meta data configuration files (under config/meta folder). Default value is false.
  • disableAppConfig – true, to stop creating application configuration files. Uncommon to turn this option off. Default value is false.

There is one another way you can control these parameters via your application code, programmatically. Subscribe to Application object’s AfterAppFrxSettingsLoaded event and set these values. Example below shows the code snippet to accomplish it

ChoApplication.AfterAppFrxSettingsLoaded += ((s, e) =>
        if (e.Value is ChoAppFrxSettings)
            ChoAppFrxSettings z = e.Value as ChoAppFrxSettings;
            z.DisableAppConfig = false;
            z.DisableFrxConfig = true;
            z.DisableMetaDataConfig = true;

Make sure you subscribe to this event at the start of the application in order to override these parameters. That all, give it a try.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s