Esempio n. 1
0
        /// <summary>
        /// 创建默认的配置文件
        /// </summary>
        private static DBConfigurationSection CreateDefaultConfiguration()
        {
            DBConfigurationSection defined = new DBConfigurationSection();

            defined.ProviderSection           = new DBProviderConfigSection();
            defined.ProviderSection.Providers = new DBProviderConfigElementCollection();
            return(defined);
        }
Esempio n. 2
0
 /// <summary>
 /// 处理错误
 /// </summary>
 /// <param name="ex">出错类</param>
 /// <remarks>是否重新处理数据库访问出错</remarks>
 protected virtual void HandleExecutionError(Exception ex)
 {
     if (DBConfigurationSection.GetSection().OverrideExceptions)
     {
         throw new DataException(DbError.DBErrorCaption, ex);
     }
     else
     {
         throw ex;
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 从congfig文件中获取定义的配置信息
 /// </summary>
 /// <returns></returns>
 public static DBConfigurationSection GetSection()
 {
     if (null == _defined)
     {
         _defined = System.Configuration.ConfigurationManager.GetSection(DBConfigurationSection.DBConfigSectionElement) as DBConfigurationSection;
         if (null == _defined)//没有配置文件则创建一个
         {
             _defined = CreateDefaultConfiguration();
         }
     }
     return(_defined);
 }