DataPropertyConfigurationHandler.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Configuration;
  5. using System.Xml;
  6. using ETD.Log;
  7. namespace ETD.Data
  8. {
  9. /// <summary>
  10. /// 数据库访问接口配置
  11. /// </summary>
  12. public class DataPropertyConfigurationHandler:IConfigurationSectionHandler
  13. {
  14. #region IConfigurationSectionHandler 成员
  15. public object Create(object parent, object configContext, System.Xml.XmlNode section)
  16. {
  17. Dictionary<string, DatabaseProperty> databasePropertyList = new Dictionary<string, DatabaseProperty>();
  18. XmlNodeList dbpList = section.SelectNodes("DatabaseProperty");
  19. foreach (XmlNode node in dbpList)
  20. {
  21. DatabaseProperty dbp = new DatabaseProperty();
  22. dbp.DatabaseType = GetDatabaseType(node.SelectSingleNode("DatabaseType").InnerText);
  23. dbp.ConnectionString = node.SelectSingleNode("ConnectionString").InnerText;
  24. databasePropertyList.Add(node.Attributes["name"].Value, dbp);
  25. }
  26. return databasePropertyList;
  27. }
  28. #endregion
  29. }
  30. }