hisystems/DatabaseObjects — Issue #10: Improve Connection.Start and Connection.Finished calls
Author: hisystems
Created: 2012-03-04 07:12:40+00:00
State: open

Currently, before accessing the database the connection must be ensured to be opened. This is achieved with the Database.Connection.Start. This call will open the connection if it has not already been opened. Similarly the Database.Connection.Finished call will close the connection if it is the last Finished call. If the Finished call is embedded within the bounds of a Start / Finished call set then the Finished call does nothing, it only decrements a counter.

The issue with this approach is that if an exception occurs the Finished call may not be called (unless it is in the finally section of a try / catch).