コード例 #1
0
        void IPgConnectionStash.RetreiveConnections(IConfigurationItem node)
        {
            foreach (IConfigurationItem item in node.ConfigurationItems)
            {
                IPgConnection dbCon = new PgConnection();
                foreach (IConfigurationItem it in item.ConfigurationItems)
                {
                    it.Configuration = node.Configuration;
                    switch (it.Name)
                    {
                    case "name": dbCon.Name = it.Value; break;

                    case "server": dbCon.Server = it.Value; break;

                    case "port": dbCon.Port = it.Value; break;

                    case "database": dbCon.Database = it.Value; break;

                    case "user": dbCon.User = it.Value; break;

                    case "password": dbCon.Password = it.GetValue(""); break;
                    }
                }
                dbCon.Persist = true;

                if (!_DbSettings.Keys.Contains <string>(dbCon.Name))
                {
                    log.Debug("Retrieve database connection: " + dbCon.ToString());

                    _DbSettings.Add(dbCon.Name, dbCon);
                }
            }
        }
コード例 #2
0
        IPgConnection IPgConnection.Clone()
        {
            IPgConnection result = new PgConnection();

            result.Name = _Name;

            result.Server = _Server;
            result.Port   = _Port;

            result.Database = _Database;

            result.User     = _User;
            result.Password = _Password;

            result.Persist = _Persist;

            return(result);
        }