除非我做錯了什麼,順便我應該使用的ConfigurationSection,和的ConfigurationElement ConfigurationElementCollection中,要求我格式化我的配置部分,像這樣:web.config中的自定義配置節和不必要的冗長
<serviceAuthorization>
<credentials>
<login username="system" password="password" mode="include">
<services>
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</services>
</login>
<login username="test" password="pass" mode="exclude" />
</credentials>
</serviceAuthorization>
我如果我在格式中多說一點,會更喜歡。我想格式化我的部分是這樣的:
<serviceAuthorization>
<login username="system" password="password" mode="include">
<service type="AxeFrog.Mobile.Service.Security.AuthenticationService, AxeFrog.Mobile.Service" />
<service type="AxeFrog.Mobile.Service.Security.AnotherService, AxeFrog.Mobile.Service" />
</login>
<login username="test" password="pass" mode="exclude" />
</serviceAuthorization>
有沒有一種方法,我可以得到配置節的XML,只是讀它自己?
據我瞭解,IConfigurationSectionHandler已被棄用 – 2009-09-01 08:08:03
你是絕對正確的。我將它添加到我的答案中。 – 2009-09-01 08:52:01