当前位置:编程学习 > C#/ASP.NET >>

EnterpriseLibrary中获取外部配置文件

在EnterpriseLibrary1.0中,它有一个Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationManager类.
类中也提供了一个GetCurrentContext()方法.
也提供了GetConfiguration()方法来获取配置文件中某个节点.
比如:ConfigurationManager.GetConfiguration("SystemConfiguration") as SystemConfiguration;

比如我获取一个数据库的信息
DatabaseConfigurationView oView = null;
ConfigurationContext oContext = null;
oContext = ConfigurationManager.GetCurrentContext();
oView = new DatabaseConfigurationView( oContext );
oView.GetDatabaseSettings().ConnectionStrings[0].Parameters[strParamName].Value ;

但是在EnterpriseLibrary2.0中已经改成了一个接口类IConfigurationSource

在EnterpriseLibrary2.0我该如何实现这个GetConfiguration()方法.和获取一个数据库信息.
小弟对EnterpriseLibrary2.0不熟 --------------------编程问答-------------------- sf
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,