Esempio n. 1
0
        public PDBConnection GetConnection(string serverName)
        {
            string tmpName = serverName.ToLower();

            if (!connPoolDic_.ContainsKey(tmpName))
            {
                ServerItem serItem = TableSet.GetImpl().GetServerInfo(tmpName);
                if (serItem == null)
                {
                    throw new Exception("server not found");
                }

                string connStr = string.Format("server={0};port={1};username={2};password={3}",
                                               serItem.IP, serItem.Port, serItem.User, serItem.Pwd);

                lock (this)
                {
                    if (!connPoolDic_.ContainsKey(tmpName))
                    {
                        connPoolDic_.Add(tmpName, new ConnectionPool(connStr, serItem.MaxConn));
                    }
                }
            }

            return(connPoolDic_[tmpName].GetConnection());
        }
Esempio n. 2
0
        public static TableSet GetImpl()
        {
            if (impl_ == null)
            {
                impl_ = new TableSet();
            }

            return(impl_);
        }
Esempio n. 3
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     TableSet.GetImpl().LoadCfg();
 }