Product Documentation

c-treeACE V11.0 Release Notes

Previous Topic

Next Topic

ADO.NET Provider - Prevent Reusing a Disposed CtreeSqlConnection

An issue was encountered with code similar to the following:


DbConnection conn

...

if(conn == null)

conn = new CtreeSqlConnection();

...

using (conn)

{

doStuff(conn);

}

...

doStuff(conn); // conn disposed by "using"

The using() was calling conn.dispose() and then the disposed connection was re-used. A disposed CtreeSqlConnection, and any disposed object in general, must not be reused. Prior to this change, the driver logic allowed this to work normally except that Commit() and Rollback() had no effect.

Because disposing a CtreeSqlConnection also disposes the underlying DbConnection, which could have other possible side effects, c-treeACE now throws an exception if Open() is called on a disposed CtreeSqlConnection.

TOCIndex