Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 17, 2012 04:12 AM by shree_ars
Jul 04, 2012 09:24 AM|LINK
Is it possible to create child .config file in .net
my need is right now i have dumped all configurations such as (connectionstring, exception....etc) are in single .config file
i need to split into seperate one.. such as
one main .config
and 2 or 3 sub config which are also interconnected with main.config and also 2 and 3 also get interconnected.
any solution for this..
thanks in advance
Jul 04, 2012 09:28 AM|LINK
You can define configsource attribute in web.config for external config files.
<?xml version='1.0' encoding='utf-8'?>
You can use file attribute also:
Jul 04, 2012 09:30 AM|LINK
using ConfigSource attribute we can split the configuration into more than one file.
Please have a look
Jul 04, 2012 09:59 AM|LINK
Hi guys..thanks for the reply..
see all samples are relates to Connectionstring...which is direct approach by using ConfigSource..
but my need is
1) connection string
3) UnityContainer (which uses both connectionstring and exceptionhandling)
so if we placed all three parts as seperate .config..how we communicate between three... ?
Jul 06, 2012 06:56 PM|LINK
Many (most?) elements in web.config support the configSource attribute. For example, connectionStrings, appSettings, customErrors, authorization...
Jul 16, 2012 06:37 AM|LINK
In my config file i have unity part configuration.
now i need to seperate this unity configuration to seperate config file and map this new config file to main config
how to do it....any solution or possible way of do this?
Jul 17, 2012 04:12 AM|LINK
yes i got the solution.
For each config section that we add in main configuration file(web.config or app.config) we can make sub configuration file.
while creating sub config file these need to be taken care
1) sub config file should not contain configuration node(i.e its parent node)
2) only one config section should be defined in single sub config file
In order to map the sub sonfig file in main config
just add "configSource" to the corresponding section node..this will map the sub configuration values.
for connection string we already have "configSource" property, but for others we can add manually.