[Mono-list] Questions about coding style

Philippe Grohrock philippe.grohrock at gmail.com
Mon Aug 20 21:01:29 UTC 2012

> Be carefull about this way of working with DB. You must free the
> connections as fast as you can and I'm not sure you can do like this way.

Basically the connection gets initialised when the application starts and
every time I need a query, the connection gets opened, queried, closed, but
not disposed. Connection.dispose() happens right before the application

> What happen if you dispose the connection ? That would be the usual way of
> freeing the queue (or thru the 'using' blocks).

My idea was to never dispose the connection to make the code a bit lighter.
That way I don't have to re-initialise the connection each time I need a
single query. Instead I have one connection with pooling enabled that gets
opened and closed when I need it.

Now my problem is, that even there I'm not sure if this is a good way of
dealing with that problem, it's just the idea to not create and dispose the
connection for each query that lead me to do things this way. But in the
end, does that even make a difference in terms of connection speed and
resource usage?

Forgive me for asking such basic questions, but when it comes to
organisation of code and using resources wisely I'm still learning.

View this message in context: http://mono.1490590.n4.nabble.com/Questions-about-coding-style-tp4656301p4656325.html
Sent from the Mono - General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20120820/bf98f57c/attachment.html>

More information about the Mono-list mailing list