Tag: sqlconnection connection pool

  • Connection Pooling and the “Timeout expired” exception

    Consider this pseudocode: /* TData tabele of data to elaborate */ ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>(); Parallel.ForEach(TData.AsEnumerable (),row => { try { using (WorItem p = new WorkItem(row,connectionstring)) { p.DoWork(); } } catch (Exception ex) { exceptions.Enqueue(ex); } }); Inside class WorkItem.DoWork, there are some database read with custom tableadapter and one finally write of…