2
我們使用來自entlib 4.1的緩存和日誌記錄應用程序塊。我們希望將這兩者的配置保存在單獨的文件中。我們怎樣才能做到這一點?企業庫4.1的多個配置源?
它看起來像entlib總是使用selectedSource作爲它的配置。
我試過如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9057346a2b2dcfc8" />
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="messagesCache">
<sources>
<add name="messagesCache" filePath="Configuration\\messagesCache.config" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9057346a2b2dcfc8" />
<add name="logging" filePath="Configuration\\logging.config" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=9057346a2b2dcfc8" />
</sources>
</enterpriseLibrary.ConfigurationSource>
</configuration>
但是,這並不工作,因爲應用程序塊始終使用selectedSource屬性值。
***運行時段*** ** configSource的問題** – Kiquenet 2015-07-01 11:28:54