Enterprise Library Data Access Application Block  7.0-rc1
The Data Access Application Block abstracts the actual database you are using, and exposes a collection of methods that make it easy to access that database and to perform common tasks.
Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper Class Reference

This is a small helper class used to manage closing a connection in the presence of transaction pooling. We can't actually close the connection until everyone using it is done, thus, we need reference counting. More...

Inheritance diagram for Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper:

Public Member Functions

 DatabaseConnectionWrapper (DbConnection connection)
 Create a new DatabaseConnectionWrapper that wraps the given connection . More...
 
void Dispose ()
 Decrement the reference count and, if refcount is 0, close the underlying connection. More...
 
DatabaseConnectionWrapper AddRef ()
 Increment the reference count for the wrapped connection. More...
 

Protected Member Functions

virtual void Dispose (bool disposing)
 Usual Dispose pattern folderal to shut up FxCop. More...
 

Properties

DbConnection Connection [get]
 The underlying DbConnection we're managing. More...
 
bool IsDisposed [get]
 Has this wrapper disposed the underlying connection? More...
 

Detailed Description

This is a small helper class used to manage closing a connection in the presence of transaction pooling. We can't actually close the connection until everyone using it is done, thus, we need reference counting.

User code should not use this class directly - it's used internally by the authors of DAAB providers to manage connections when using the DAAB methods.

Constructor & Destructor Documentation

◆ DatabaseConnectionWrapper()

Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.DatabaseConnectionWrapper ( DbConnection  connection)

Create a new DatabaseConnectionWrapper that wraps the given connection .

Parameters
connectionDatabase connection to manage the lifetime of.

Member Function Documentation

◆ AddRef()

DatabaseConnectionWrapper Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.AddRef ( )

Increment the reference count for the wrapped connection.

◆ Dispose() [1/2]

void Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.Dispose ( )

Decrement the reference count and, if refcount is 0, close the underlying connection.

<filterpriority>2</filterpriority>

◆ Dispose() [2/2]

virtual void Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.Dispose ( bool  disposing)
protectedvirtual

Usual Dispose pattern folderal to shut up FxCop.

Parameters
disposingtrue if called via DatabaseConnectionWrapper.Dispose() method, false if called from finalizer. Of course, since we have no finalizer this will never be false.

Property Documentation

◆ Connection

DbConnection Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.Connection
get

The underlying DbConnection we're managing.

◆ IsDisposed

bool Microsoft.Practices.EnterpriseLibrary.Data.DatabaseConnectionWrapper.IsDisposed
get

Has this wrapper disposed the underlying connection?


The documentation for this class was generated from the following file: