private static ConnectionStringElement GetConfiguration(string name)
        {
            ConnectionManagerConfigurationSection section =
                ConnectionManagerConfigurationSection.GetConfig();

            ConnectionStringConfigurationElement configElement = section.ConnectionStrings[name];
            ConnectionStringElement element = null;

            // 本地配置文件的连接串采用优先级高于Meta库中的
            if (configElement != null)
            {
                element = new ConnectionStringElement();
                element.ConnectionString = configElement.ConnectionString;
                element.ProviderName     = configElement.ProviderName;
                element.EventArgsType    = configElement.EventArgs.Type;
                element.Name             = configElement.Name;
                element.CommandTimeout   = configElement.CommandTimeout;
            }
            else
            {
                // 备选通道是从Meta库获取
                MetaConnectionStringConfigurationElement metaElement = section.MetaConnectionString;
                if (metaElement != null)
                {
                    element = metaElement.GetConnectionStringElement(name);
                }
            }

            return(element);
        }
        /// <summary>
        /// 获取配置文件中的数据库连接(ConnectionManager)集合
        /// </summary>
        /// <returns></returns>
        public static ConnectionManagerConfigurationSection GetConfig()
        {
            ConnectionManagerConfigurationSection section =
                (ConnectionManagerConfigurationSection)ConfigurationBroker.GetSection("connectionManager");

            ConfigurationExceptionHelper.CheckSectionNotNull(section, "connectionManager");

            return(section);
        }
        /// <summary>
        /// 获取指定连接的Database对象
        /// </summary>
        /// <param name="name">数据库逻辑名称</param>
        /// <returns>连接的Database对象</returns>
        internal static Database GetDataProvider(string name)
        {
            string providerName = GetDbProviderName(name);

            ConnectionManagerConfigurationSection section = ConnectionManagerConfigurationSection.GetConfig();

            DataProviderConfigurationElement configProvider = section.DataProviders[providerName];

            //沈峥添加(2008-08-26),检查dataProvider配置是否正确
            ExceptionHelper.FalseThrow <ConfigurationException>(configProvider != null, Resource.CanNotFindProviderName, name, providerName);

            return((Database)configProvider.CreateInstance(name));
        }