SubSonic-3.0-Templates icon indicating copy to clipboard operation
SubSonic-3.0-Templates copied to clipboard

Connections being left open during template transformation.

Open tombatron opened this issue 14 years ago • 0 comments

When generating a data layer on a database with 200+ tables we noticed that Visual Studio would freeze, crash and never complete the transformation. Upon further investigation we found that the freeze was occurring due to the ADO.NET connection pool running out of available connections, which seemed to cause the template transformation process to wait for an available connection. A work around for this issue is to add the "Max Pool Size" attribute to your connection string and set the number above the default of 100.

We patched this issue in our environment by changing the following methods so that they do not use the GetReader or GetCommand methods to open SQL connections:

  • LoadTables
  • LoadColumns
  • LoadFKTables
  • GetPK

Instead, the methods listed above instantiate the SQL connection, command, and data reader from within the method.

tombatron avatar Aug 25 '09 18:08 tombatron