Multiple configuration section for different developers

Building on my last post Custom Configuration section….

We often have multiple developers working on the same project but want to be running under different configurations. We do this by adding their machine name to custom config section and replacing the static constructor of the custom config section:

    static Configuration()
    {
      const string ConfigurationSectionName = "ISI.HAPP.API.Configuration";

      Current = null;
      if (Current == null) Current = (Configuration)(System.Configuration.ConfigurationManager.GetSection(string.Format("{0}.{1}", ConfigurationSectionName, System.Environment.MachineName.ToLower())));
      if (Current == null) Current = (Configuration)(System.Configuration.ConfigurationManager.GetSection(ConfigurationSectionName));
      if (Current == null) throw new Exception(string.Format("Missing {0} Configuration Section", ConfigurationSectionName));
    }

and adding a new config section in the app/web.config:

  <ISI.HAPP.API.Configuration.ronmuth>
    <CompanyName>ISI Ron Muth</CompanyName>
    <Authenication>
      <UseNTPermissions>true</UseNTPermissions>
      <DefaultNTDomain>ISI</DefaultNTDomain>
    </Authenication>
  </ISI.HAPP.API.Configuration.ronmuth>
Published 06/19/2009 20:20:24 (UTC) by Ron Muth

kick it on DotNetKicks.com  Shout it  vote it on WebDevVote.com

Comments

DotNetKicks.com Multiple configuration section for different developers

10/23/2009 19:42:49 by DotNetKicks.com
You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetBurner - .net Framework Multiple configuration section for different developers

10/23/2009 19:45:48 by DotNetBurner - .net Framework
DotNetBurner - burning hot .NET content

DotNetShoutout Multiple configuration section for different developers

10/24/2009 12:05:24 by DotNetShoutout
Thank you for submitting this cool story - Trackback from DotNetShoutout

Leave a Comment

(required)
(required)
(optional, never published)
(optional)
(required)