⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eaisetting.cs

📁 该文件是多层体系结构的数据访问层
💻 CS
字号:
#region Copyright & License
//
// Copyright (C) Maxspeed BeiJing, 2004
//
#endregion
#region Document Information
// $Author: MBJ\deng.maosheng $
// $Rev: 15 $ 
// $Date: 2004-09-22 19:50:09 +0800 (Wed, 22 Sep 2004) $
#endregion

using System;
using System.Configuration;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Xml;

namespace Eai.Configuration
{
    /// <summary>
    /// EAI配置信息。
    /// </summary>
    /// <remarks>
    /// EaiSetting并不实际读取配置信息,而是将配置节设置到<see cref="ConfigSection"/>属性上,
    /// 其它部分定义自己的配置类,并从<see cref="ConfigSection"/>读取配置信息。这种方式的好处在于不会因为其它部分配置的变化而修改EaiSetting类。
    /// </remarks>
#if DEBUG //only for test
    public
#else
        internal
#endif
    class EaiSetting
    {
        public EaiSetting()
        {
        }

        private static object syncObj = new Object();
        private static EaiSetting setting;
        /// <summary>
        /// 从配置中读取EaiSetting。
        /// </summary>
        public static EaiSetting CurrentSetting
        {
            get
            {
                if (setting != null) return setting;

                lock (syncObj)
                {
                    if (setting != null) return setting;

                    setting = ConfigurationManager.GetSection("eai") as EaiSetting;
                    if (setting == null) setting = new EaiSetting();
                }

                return setting;
            }
        }

        private XmlNode configSection;
        /// <summary>
        /// 配置节点。
        /// </summary>
        public XmlNode ConfigSection
        {
            get
            {
                return configSection;
            }
        }

        /// <summary>
        /// 从映射配直节中读取EAI信息。
        /// </summary>
        /// <param name="xnode">定义EAI配置信息的XML节点。</param>
        public void Load(XmlNode xnode)
        {
            configSection = xnode;
        }

        /// <summary>
        /// 从Xml字符串中读取配置文件。
        /// </summary>
        /// <param name="xmlString">定义EAI配置信息的XML字符串。</param>
        public void Load(string xmlString)
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xmlString);
            XmlNode configNode = doc.DocumentElement;
            Load(configNode);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -