原config文件
<connectionStrings>
<add name="eshop" connectionString="Data Source=(local);
Initial Catalog=tempdb;User ID=sa;" providerName="System.Data.SqlClient"/>
</connectionStrings>
修改后
<connectionStrings configSource ="dbConnection.config" />
dbConnection.config文件
代码
<?xml version="1.0" encoding="utf-8"?>
<connectionStrings>
<clear />
<add name="eshop" connectionString="Data Source=(local);
Initial Catalog=tempdb;User ID=sa;" providerName="System.Data.SqlClient"/>
</connectionStrings>
appSettings 类似
<appSettings configSource="settings.config" />
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="Blog" value="F6 Team" />
<add key="Name" value="puma" />
<add key="skill" value="ASP.NET" />
</appSettings>
<appSettings file="settings.config">
<add key="Blog" value="F6 Team" />
<add key="Name" value="puma" />
</appSettings>
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="skill" value="ASP.NET" />
</appSettings>