ServiceStack/ServiceStack — pull request #300 by driis (2012-10-21 12:02:33+00:00)
Title: Fix issue where connections does not get disposed properly when using ProfiledDbConnection

This pull request fixes an issue with the built-in MiniProfiler in ServiceStack. I checked with the original MiniProfiler code, which does not have the issue:

There are two overloads on the constructor of ProfiledDbConnection. One of those takes the autoDisposeConnection parameter and sets it default to true, which is good. The other overload **does not set autoDisposeConnection** and it is therefore false.

I had a bug in my app because my conn factory called the ProfiledDbConnection ctor that does not set autoDisposeConnection, and as a consequence, I did not get my DB connections properly disposed.

I think both constructors should set autoDisposeConnections to true by default (while allowing the user to specify it), since having it set to false can cause major trouble in a production app. This pull request fixes just that.

Since this is something that was introduced recently, (https://github.com/ServiceStack/ServiceStack/commit/751ec3e5c127ba27f0e6f2ecd91578b860fc415f), it could break applications that choose to upgrade their ServiceStack version.

Another option for fixing this could be to simply remove one of the constructors or make it protected, but that could break apps that already use that public constructor, so I opted not to do this.

I will be happy to improve on this pull request if you find anything missing from it.