Harbin.DataAccess icon indicating copy to clipboard operation
Harbin.DataAccess copied to clipboard

Connection management

Open denniscpolley opened this issue 5 years ago • 1 comments

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!

denniscpolley avatar Dec 17 '20 14:12 denniscpolley

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.

Drizin avatar Dec 17 '20 15:12 Drizin