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 "connectionStri ng", and in each case
this value is different. When the web site references them, they read the
"connectionStri ng" 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 "connectionStri ng" values, but each assembly knows
which value belongs to it.
Something like this is how I would envision it working
<configuratio n>
<configSections >
<section name="Sales" type="MyCompany .Sales"/>
<section name="CustomerS ervice"
type="MyCompany .CustomerServic e"></section> <!-- name of assemby -->
</configSections>
<!-- information for the current application -->
<appSettings>
<add key="connection String"
value="server=M yServer;databas e=location;uid= user;pwd=passwo rd"></add>
<add key="LogPath" value="c:\temp\ "></add>
<add key="PreCache" value="True"></add>
<add key="LimitSearc hBySection" value="50"></add>
</appSettings>
<!-- information for the MyCompany.Sales dll -->
<Sales>
<add key="connection String"
value="server=S alesServer;data base=Sales;uid= Salesuser;pwd=p assword"></add>
</Sales>
<!-- information for the MyCompany.Custo merService dll -->
<Sales>
<add key="connection String"
value="server=C SServer;databas e=Sales;uid=css user;pwd=passwo rd"></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 "connectionStri ng", and in each case
this value is different. When the web site references them, they read the
"connectionStri ng" 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 "connectionStri ng" values, but each assembly knows
which value belongs to it.
Something like this is how I would envision it working
<configuratio n>
<configSections >
<section name="Sales" type="MyCompany .Sales"/>
<section name="CustomerS ervice"
type="MyCompany .CustomerServic e"></section> <!-- name of assemby -->
</configSections>
<!-- information for the current application -->
<appSettings>
<add key="connection String"
value="server=M yServer;databas e=location;uid= user;pwd=passwo rd"></add>
<add key="LogPath" value="c:\temp\ "></add>
<add key="PreCache" value="True"></add>
<add key="LimitSearc hBySection" value="50"></add>
</appSettings>
<!-- information for the MyCompany.Sales dll -->
<Sales>
<add key="connection String"
value="server=S alesServer;data base=Sales;uid= Salesuser;pwd=p assword"></add>
</Sales>
<!-- information for the MyCompany.Custo merService dll -->
<Sales>
<add key="connection String"
value="server=C SServer;databas e=Sales;uid=css user;pwd=passwo rd"></add>
</Sales>
</configuration>
Thanks for any help or insight.
Joe
Comment