1
Vote

Issue with Connections in Pool being closed and unusable

description

Using SQLCE on compact framework 3.5 with CE6.

The connection in the connection pool was closed and had no connection string. The GetPoolConnection method returned an unusable connection. I did not workout where the connection was being closed. So put a check at the start of this method.

More of a work around than solution but with this ORM is performing well and is usable.
        lock (m_connectionPool)
        {
//new code
bool doneOne = false;
            do
            {
                doneOne = false;    
                var closed = (from c in m_connectionPool
                              where c.State == ConnectionState.Closed
                              select c).FirstOrDefault();
                if (closed != null)
                {
                    m_connectionPool.Remove(closed);
                    Interlocked.Decrement(ref m_connectionCount);
                    doneOne = true;
                }
            } while (doneOne);
//existing code
            IDbConnection connection = null;

            do

comments