1

我追求的配置看起来像这样

 <configuration>
 <configSections>
   <section name="dwdev" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0,Culture=neutral,x" />
   <section name="dwdevfin" type="System.Configuration.NameValueSectionHandler,System,Version=1.0.3300.0,Culture=neutral,x" />
</configSections>
<dwdev>
  <add key="DatabaseType" value="Student" />
  <add key="ReportDataPath" value="x" />
  <add key="ProgressDataPath" value="x" />
  <add key="DWDataConnectionString" value="Data Source=rnddb;Initial Catalog=x;User ID=x" />
  <add key="x" value="Data Source=rnddb;Initial Catalog=dwdevsystem;User ID=x;pwd=x" />
  <add key="WebServiceRoot" value="x" />
  <add key="AllowExternalUsersGroups" value="True" />
</dwdev>
<dwdevfin>
  <add key="DatabaseType" value="Finance" />
  <add key="ReportDataPath" value="x />
  <add key="ProgressDataPath" value="x" />
  <add key="x" value="Data Source=rnddb;Initial Catalog=x;User ID=x" />
  <add key="x" value="Data Source=rnddb;Initial Catalog=x;User ID=dx;pwd=x" />
  <add key="WebServiceRoot" value="x" />
  <add key="AllowExternalUsersGroups" value="True" />
</dwdevfin>
</configuration>

是否可以允许用户添加其他部分?或者您是否必须通过将它们放在 configSections 中而不是像下面这样的集合来专门声明它们

<configSections>
<section name="Settings" type="SQLQueryOutput.MySection, SQLQueryOutput" />
</configSections>

<Settings>
<Components Name="Test">
  <Component Name="Portal" Type="Web" />
  <Component Name="Comms" Type="Web" />
  <Component Name="Scheduler" Type="WindowsService" ServiceName="LiveScheduler" />
 </Components>

 <Components Name="AnotherTest">
  <Component Name="Portal" Type="Web" />
  <Component Name="Comms" Type="Web" />
  <Component Name="Scheduler" Type="WindowsService" ServiceName="LiveScheduler" />
 </Components>
 </Settings>
 </configuration>
4

0 回答 0