Hi Patrice,
What I'm trying to do is ensure that the database connection is closed when
a transaction handler is released to the pool. All of my transaction
handlers derive from the same base class - eRxProcessor, which implements
the IhttpHandler interface. The eRxProcessor instantiates our DataBroker
class, which opens a DB connection, and provides the Databroker to its
derived classes via a protected property. If I can implement the close of
the DB connection in the eRxProcessor base class, I can guarantee that
pooled objects aren't going to be holding onto open connections, without
having to rely on the developers, who develop the derived classes to do so.
The pattern you suggest would be applicable to an HttpModule since it
receives these events. However, our transaction handlers are implemented as
HttpHandlers; these do not receive these events.
I understand that IsReusable is used to describe whether a particular class
instance is reusable or not. However, this describes only a small subset of
the spec for the IsReusable property. I haven't found the documentation to
describe exactly when IsReusable is called. Is it called when the instance
is created intially? Or is it called when its client releases its reference?
There is a world of difference between these two patterns, the most obvious
being whether an instance can begin 'life' as a poolable object, and then
subsequently switch itself into a non-poolable state due to conditions
encountered on a subsequent access. Another benefit to the latter patern
would be the ability to receive notification when the object is about to be
released into the pool (or not).
Is this stuff documented? Or do I have to prototype this to fill the gap in
the documentation?
Thanks,
Joseph Geretz