Ejemplo 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");
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnException(MethodExecutionEventArgs eventArgs)
        {
            ExeConfigurationFileMap file = new ExeConfigurationFileMap();

            file.ExeConfigFilename = AppDomain.CurrentDomain.BaseDirectory + "\\App.config";
            Configuration AppConfig = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None);
            DataBaseProviderConfigurationSection _section = (DataBaseProviderConfigurationSection)ConfigurationManager.GetSection("JITE.CIS.Framework/DBProvider");

            if (!Convert.ToBoolean(_section.UseLog))
            {
                return;
            }
            ParameterInfo[] ps         = eventArgs.Method.GetParameters();
            object[]        pv         = eventArgs.GetWritableArgumentArray();
            string          parameList = "[";

            for (int i = 0; i < ps.Length; i++)
            {
                Console.WriteLine(" {0}={1}", ps[i].Name, pv[i]);
                parameList += ps[i].Name + "=" + pv[i] + ";";
            }
            parameList += "]";
            OutputErrLog(eventArgs.Method.Name, parameList, "true", eventArgs.Exception, _section.LogPath);
        }
Ejemplo n.º 3
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");
                 }
             }
         }
     }
 }