Exemplo n.º 1
0
        private static void GetProviders()
        {
            GenericCache <string, DataBaseProvider> .TryGetValue("DBProvider", out _provider);

            if (_provider == null)
            {
                lock (_lock)
                {
                    if (_provider == null)
                    {
                        _section   = (DataBaseProviderConfigurationSection)ConfigurationManager.GetSection("JITE.CIS.Framework/DBProvider");
                        _providers = new DataBaseProviderCollection();
                        ProvidersHelper.InstantiateProviders(_section.Providers, _providers, typeof(DataBaseProvider));
                        _provider = _providers[_section.DefaultProvider];
                        GenericCache <string, DataBaseProvider> .Add("DBProvider", _provider);

                        if (_provider == null)
                        {
                            throw new ProviderException("不能获取默认的 DBProvider");
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 private static void GetProviders()
 {
     GenericCache<string, DataBaseProvider>.TryGetValue("DBProvider", out _provider);
     if (_provider == null)
     {
         lock (_lock)
         {
             if (_provider == null)
             {
                 _section = (DataBaseProviderConfigurationSection)ConfigurationManager.GetSection("JITE.CIS.Framework/DBProvider");
                 _providers = new DataBaseProviderCollection();
                 ProvidersHelper.InstantiateProviders(_section.Providers, _providers, typeof(DataBaseProvider));
                 _provider = _providers[_section.DefaultProvider];
                 GenericCache<string, DataBaseProvider>.Add("DBProvider", _provider);
                 if (_provider == null)
                 {
                     throw new ProviderException("不能获取默认的 DBProvider");
                 }
             }
         }
     }
 }