Hi
do I need to explicitly close IDbConnection and IDbCommand objects? Or are
they disposed of when the method they are used in ends?
Normally I use a construct like:
using (IDbConnection conn = GetConnection()) // where "GetConnection gets a
database connection
{
// do database stuff
}
and as I understand it this ensures that the connection object is correctly
closed (even if an exception is thrown when the connection object is used).
But I have also seen code without any form of "using" or
"try/catch/finally". Will the obtained connection in these cases be
correctly closed when the method using the connection ends?
thanks,
Peter