我的web.config中有以下结构:
<sectionGroup name="MuniAxis">
<sectionGroup name="BusinessEntitiesConstants" >
<section name="FirmStatus" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="OfferingStatus" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="Role" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="UserStatus" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="BidStatus" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="TransformTableTypes" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
</sectionGroup>
<sectionGroup name="Configurations" >
<section name="LocalizationFormats" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="SellSection" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="SenchaFormatDate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="SenchaFormatDateHour" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="SenchaFormatLongDateHour" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="SenchaFormatShortLongDateHour" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
<section name="ExportTemplates" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
</sectionGroup>
</sectionGroup>
然后:
<OfferingStatus>
<add key="SC" value="dd52f926-b2a3-4d9a-af77-9654703f042b" />
<add key="SM" value="a5702845-9846-4f3b-b05c-b2f767da1319" />
<add key="PT" value="5bfb027e-4e84-4493-98fb-f63dbe11b6ab" />
<add key="PN" value="ed2dc55e-81a0-4056-a20d-507a49d2b52f" />
<add key="XM" value="3959478b-ce67-455e-a29c-f9e425c6040d" />
<add key="NV" value="a496c982-0d0a-4ec8-a70d-6b41100da93c" />
<add key="XS" value="bef615b7-eb26-4332-b350-106e6cbf4b6f" />
<add key="CS" value="f675ffb5-c2f5-4df5-9115-8590e029b156" />
<add key="FM" value="d371f202-2afd-46f9-b0c3-7999d6813939" />
<add key="TS" value="2aff5a4f-9ff0-4dbc-8fe0-11bc0dcc2935" />
<add key="AU" value="0042f7ee-c0ac-48f6-9c69-7e9ff2fa1129" />
<add key="VB" value="9da3cc81-fba2-48fd-acec-56e6a7ec7d79" />
<add key="CT" value="e66d03f4-f0b8-4247-ae5e-5f1f234bd8fe" />
<add key="TB" value="69B711C5-D98C-439D-A196-DC841F6DD9FA" />
<add key="TT" value="31598ec5-51e3-4536-a4f1-318dc44744b2" />
<add key="CV" value="f6fc0dc8-c30d-4f6d-bbcf-5b18ab7f82c9" />
<add key="NV" value="e4916043-43a4-4737-bd47-79cb68100697" />
<add key="NS" value="8be0faa3-1ffa-4ab1-a144-8a7acece9f85" />
</OfferingStatus>
<BidStatus>
<add key="C" value="7b49c6ff-af46-4cb6-a105-27fbb64c6844" />
<add key="H" value="bac0d838-6497-427d-a261-24bb3e4b85b7" />
<add key="F" value="b286a107-9bf8-47d5-8069-2af35ca2cebe" />
<add key="O" value="a99fbcc6-97f8-440b-8d91-87be085756c1" />
</BidStatus>
<Role>
<add key="Administrator" value="1CF63AFA-EDAD-4C8B-A02C-BB3B0C78C210" />
<add key="ReadOnlyAdmin" value="A1610716-6FF0-45AF-83F0-72C53730295D" />
<add key="HeadTrader" value="75BEAF5B-0403-4D64-97CC-04569C8BCA6A" />
<add key="Trader" value="7EE59880-A80F-4710-BBA8-822029D3CB72" />
</Role>
<UserStatus>
<add key="Active" value="22479ED8-6494-409A-9820-23D0AC662368" />
<add key="Inactive" value="B7A69F67-5965-4DFF-8EA7-15545E2778DC" />
<add key="PendingAgreement" value="A8AA5639-8700-4A7C-9564-EC8AC364A32A" />
</UserStatus>
<TransformTableTypes>
<add key="ImportSellOfferings" value="C5B0513D-45EF-4F5F-9DF7-33044AACE475"/>
</TransformTableTypes>
</BusinessEntitiesConstants>
<Configurations>
<LocalizationFormats>
<add key="DefaultCultureInfo" value ="en-US" />
<add key="ShortDatePattern" value="MM/dd/yy"/>
<add key="ShortTimePattern" value="hh:mm tt"/>
<add key="ShortDateTimePattern" value="MM/dd/yy hh:mm tt"/>
<add key="SenchaFormatDate" value="m/d/y"/>
<add key="SenchaFormatDateHour" value="m/d/y g:i a"/>
<add key="SenchaFormatLongDateHour" value="m/d/y g:i:s A"/>
<add key="SenchaFormatShortLongDateHour" value="m/d/y g:i"/>
</LocalizationFormats>
<!--Configuration for Sell Section.-->
<SellSection>
<!--Configuration for Sell Section.
DeadLineDateAuction: Limit Hour for Create a Auction and schedules for to today (format:HH:MM AM/PM).
OffSetStartAuction: Default delay for initialize the Auction. The value indicate next half hour/next Hour etc... (format:HH:MM).
InitialDateAuction: Default hour that will be initialize the Auction for next day (format:HH:MM AM/PM).
OffSetEndAuction: Default duration default of Auction (format:HH:MM).
OffSetFirmUtil: Default delay for trade bond. (format:HH:MM).
OffSetSettelmentDate:Default delay in days for Settlement. (format:dd).
DeadLineOperations: Hour with System not permit more operations (format:hh:mm AM/PM).
PermitEndAuctionUpTo: Hour up to End Auction (format: hh:mm AM/PM).
-->
<add key="DeadLineDateAuction" value="03:00 PM"/>
<add key="OffSetStartAuction" value="00:30 AM"/>
<add key="InitialDateAuction" value="09:00 AM"/>
<add key="OffSetEndAuction" value="04:00 AM"/>
<add key="OffSetFirmUtil" value="01:00 AM"/>
<add key="OffSetSettelmentDate" value="03"/>
<add key="DeadLineOperations" value="05:00 PM" />
<add key="PermitEndAuctionUpTo" value="04:30 PM" />
</SellSection>
<ExportTemplates>
<add key="BidDetailsExcelTemplate" value="D:\dev\MuniAxis\Code\trunk\MuniAxis\ReportTemplates\BidDetails.xlsx" />
<add key="TraderReportExcelTemplate" value="D:\dev\MuniAxis\Code\trunk\MuniAxis\ReportTemplates\TraderReport.xlsx" />
<add key="BidDetailsPDFTemplate" value="D:\dev\MuniAxis\Code\trunk\MuniAxis\ReportTemplates\BidDetails.pdf" />
<add key="TraderReportPDFTemplate" value="D:\dev\MuniAxis\Code\trunk\MuniAxis\ReportTemplates\TraderReport.pdf" />
</ExportTemplates>
</Configurations>
</MuniAxis>
我想将MuniAxis中的所有内容移动到外部文件中。我知道使用configSource是不可能的,因为它不适用于节组,还有其他方法吗?
提前致谢。
答案 0 :(得分:-1)
使用ConfigurationManager.OpenMappedExeConfiguration打开配置文件,您可以在其中放置所需的部分组/部分定义和相关数据。
这个链接有一个例子可以帮助你开始。