yes, just replace the section in the default configuration file with an xml element with the same name that has the configSource = "" attribute that points to another file ...
... in yr App.config or web.config ...
<configSections>
<section name="Connections"
type="BPA.AMP.Configuration.XmlConfigurator, BPA.AMP.Data.Config.DAL"/>
<section name="AutoProcessConfig"
type="BPA.AMP.Configuration.XmlConfigurator, BPA.AMP.Data.Config.DAL"/>
</configSections>
<Connections configSource="Config\Connections.config" />
<AutoProcessConfig configSource="Config\AutoProcess.config" />
And then the general xml class; Configurator
public class XmlConfigurator : IConfigurationSectionHandler
{
public object Create(object parent,
object configContext, XmlNode section)
{
XPathNavigator xPN;
if (section == null || (xPN = section.CreateNavigator()) == null )
return null;
Type sectionType = Type.GetType((string)xPN.Evaluate
("string(@configType)"));
XmlSerializer xs = new XmlSerializer(sectionType);
return xs.Deserialize(new XmlNodeReader(section));
}
}
source
share