Ejemplo 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());
        }
Ejemplo n.º 2
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     TableSet.GetImpl().LoadCfg();
 }