W
WFB
Hi
I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set up
the config file to recognize this? Im thinking section name elements, but
am not having much luck. Lets say the project has a StoreLocator assembly,
a ProductGuide assembly and the main web site. All three have a value in
thier individual config files named "connectionString", and in each case
this value is different. When the web site references them, they read the
"connectionString" value from the master (for lack of a better term)
applications config file. I would like to set up this config file somehow
where I can store three "connectionString" values, but each assembly knows
which value belongs to it.
Something like this is how I would envision it working
<configuration>
<configSections>
<section name="Sales" type="MyCompany.Sales"/>
<section name="CustomerService"
type="MyCompany.CustomerService"></section> <!-- name of assemby -->
</configSections>
<!-- information for the current application -->
<appSettings>
<add key="connectionString"
value="server=MyServer;database=location;uid=user;pwd=password"></add>
<add key="LogPath" value="c:\temp\"></add>
<add key="PreCache" value="True"></add>
<add key="LimitSearchBySection" value="50"></add>
</appSettings>
<!-- information for the MyCompany.Sales dll -->
<Sales>
<add key="connectionString"
value="server=SalesServer;database=Sales;uid=Salesuser;pwd=password"></add>
</Sales>
<!-- information for the MyCompany.CustomerService dll -->
<Sales>
<add key="connectionString"
value="server=CSServer;database=Sales;uid=cssuser;pwd=password"></add>
</Sales>
</configuration>
Thanks for any help or insight.
Joe
I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set up
the config file to recognize this? Im thinking section name elements, but
am not having much luck. Lets say the project has a StoreLocator assembly,
a ProductGuide assembly and the main web site. All three have a value in
thier individual config files named "connectionString", and in each case
this value is different. When the web site references them, they read the
"connectionString" value from the master (for lack of a better term)
applications config file. I would like to set up this config file somehow
where I can store three "connectionString" values, but each assembly knows
which value belongs to it.
Something like this is how I would envision it working
<configuration>
<configSections>
<section name="Sales" type="MyCompany.Sales"/>
<section name="CustomerService"
type="MyCompany.CustomerService"></section> <!-- name of assemby -->
</configSections>
<!-- information for the current application -->
<appSettings>
<add key="connectionString"
value="server=MyServer;database=location;uid=user;pwd=password"></add>
<add key="LogPath" value="c:\temp\"></add>
<add key="PreCache" value="True"></add>
<add key="LimitSearchBySection" value="50"></add>
</appSettings>
<!-- information for the MyCompany.Sales dll -->
<Sales>
<add key="connectionString"
value="server=SalesServer;database=Sales;uid=Salesuser;pwd=password"></add>
</Sales>
<!-- information for the MyCompany.CustomerService dll -->
<Sales>
<add key="connectionString"
value="server=CSServer;database=Sales;uid=cssuser;pwd=password"></add>
</Sales>
</configuration>
Thanks for any help or insight.
Joe