FA读取配置文件

EnterpriseLibrary 读取自定义配置文件,需要指出自定义配置文件的确切位置,在Web.Config文件里配置,通过FileConfigurationSource取得配置节点

<enterpriseLibrary.ConfigurationSource selectedSource="FileConfigurationSource">
  <sources>
    <add name="FileConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common" filePath="%SFXROOT%\config\SFXWEB.config"/>
    <add name="SystemConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common"/>
  </sources>
</enterpriseLibrary.ConfigurationSource>

通过继承SerializableConfigurationSection,在ConfigurationSourceSection.cs文件

private const string selectedSourceProperty = "selectedSource";
private const string sourcesProperty = "sources";

public const string SectionName = "enterpriseLibrary.ConfigurationSource";

通过SectionName读取Web.Config中的enterpriseLibrary.ConfigurationSource节点,找到确切路径下的配置文件。

然后再读取那个自定义配置文件,

http://item.taobao.com/auction/item_detail-0db1-9ab3754fc45f7f64c18a00779ae2fea5.jhtml

http://code.msdn.microsoft.com/

http://www.codeplex.com/entlib

EnterpriseLibrary4.1下载

http://terrylee.blog.51cto.com/342737/151941

http://blog.entlib.com/

Object Builder Application Block  企业库源码解析

http://www.cnblogs.com/ycat/archive/2006/08/19/481094.html

http://www.javaeye.com/topic/155109#

http://msdn.microsoft.com/zh-cn/library/79b3xss3%28VS.80%29.aspx

原文地址:https://www.cnblogs.com/zqstc/p/1626267.html