Esempio n. 1
0
        /// <summary>
        /// 复制一个新的数据访问对象设置类。
        /// </summary>
        /// <returns>复制的数据访问对象设置类。</returns>
        public object Clone()
        {
            GSPDbSettings copy = new GSPDbSettings();

            copy.DefaultCode = this.DefaultCode;
            copy.Connections = this.Connections;
            return(copy);
        }
Esempio n. 2
0
        /// <summary>
        ///  返回系统中数据库连接的配置。
        /// </summary>
        /// <returns>数据库连接的配置,配置文件中不存在配置节时,实例化一个新的<see cref="GSPDbSettings"/>并返回。</returns>
        /// <remarks>适用于读取所有数据库连接配置列表的场景。</remarks>
        public static GSPDbSettings GetGSPDbSettings()
        {
            GSPDbSettings settings = configurationRoot.GetSection(GSPDbSettings.SectionName).Get <GSPDbSettings>();

            if (settings != null)
            {
                settings = settings.Clone() as GSPDbSettings;
            }
            else
            {
                settings = new GSPDbSettings();
            }
            return(settings);
        }