Harbin.DataAccess
Harbin.DataAccess copied to clipboard
Connection management
How do you manage the connection in your architecture? In the examples/tests I dont see the connection wrapped in a using statement or where it explicitly calls a close/dispose method. Did I miss something? Thanks for your help!
Well, I think you're right that the provided code was not a good example.
Since I didn't use using the Dispose() is not invoked and therefore the connection remains there forever.
All Harbin connections implement IDisposable, and the Dispose() method will also dispose the underlying IDbConnections.
This means that if you use the using statement (as you would do with any other IDbConnection) it should dispose the underlying connections.