Aegis.Data.MySQL.ConnectionPool.GetDBC C# (CSharp) Метод

GetDBC() приватный Метод

private GetDBC ( ) : DBConnector
Результат DBConnector
        internal DBConnector GetDBC()
        {
            lock (this)
            {
                if (_poolDBC.Count == 0 &&
                    PooledDBCCount + ActiveDBCCount < _maxDBCCount)
                {
                    var dbc = new DBConnector();
                    dbc.Connect(IpAddress, PortNo, CharSet, DBName, UserId, UserPwd);
                    _poolDBC.Enqueue(dbc);
                }
            }


            return _poolDBC.Dequeue();
        }

Usage Example

Пример #1
0
        public void QueryNoReader()
        {
            if (_dbConnector != null || Reader != null)
            {
                throw new AegisException(AegisResult.DataReaderNotClosed, "There is already an open DataReader associated with this Connection which must be closed first.");
            }


            _dbConnector         = _pool.GetDBC();
            _command.Connection  = _dbConnector.Connection;
            _command.CommandText = CommandText.ToString();

            Prepare();
            _command.ExecuteNonQuery();
            _dbConnector.QPS.Add(1);
            EndQuery();
        }