Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32147/NHibernate/Driver
Modified Files:
NDataReader.cs NHybridDataReader.cs
Log Message:
Implemented IDisposable according to standard .net pattern
Added some more xml comments to Connection namespace.
Index: NHybridDataReader.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/NHybridDataReader.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NHybridDataReader.cs 31 Dec 2004 17:26:01 -0000 1.2
--- NHybridDataReader.cs 30 Jan 2005 19:36:15 -0000 1.3
***************
*** 29,33 ****
/// <summary>
! /// Initializes a new instance of the NHybridDataReader class.
/// </summary>
/// <param name="reader">The underlying IDataReader to use.</param>
--- 29,33 ----
/// <summary>
! /// Initializes a new instance of the <see cref="NHybridDataReader"/> class.
/// </summary>
/// <param name="reader">The underlying IDataReader to use.</param>
***************
*** 132,139 ****
#region IDisposable Members
! /// <summary></summary>
public void Dispose()
{
! _reader.Dispose();
}
--- 132,188 ----
#region IDisposable Members
! /// <summary>
! /// A flag to indicate if <c>Disose()</c> has been called.
! /// </summary>
! private bool _isAlreadyDisposed;
!
! /// <summary>
! /// Finalizer that ensures the object is correctly disposed of.
! /// </summary>
! ~NHybridDataReader()
! {
! Dispose( false );
! }
!
! /// <summary>
! /// Takes care of freeing the managed and unmanaged resources that
! /// this class is responsible for.
! /// </summary>
public void Dispose()
{
! log.Debug( "running NHybridDataReader.Dispose()" );
! Dispose( true );
! }
!
! /// <summary>
! /// Takes care of freeing the managed and unmanaged resources that
! /// this class is responsible for.
! /// </summary>
! /// <param name="isDisposing">Indicates if this NHybridDataReader is being Disposed of or Finalized.</param>
! /// <remarks>
! /// If this NHybridDataReader is being Finalized (<c>isDisposing==false</c>) then make sure not
! /// to call any methods that could potentially bring this NHybridDataReader back to life.
! /// </remarks>
! protected virtual void Dispose(bool isDisposing)
! {
! if( _isAlreadyDisposed )
! {
! // don't dispose of multiple times.
! return;
! }
!
! // free managed resources that are being managed by the NHybridDataReader if we
! // know this call came through Dispose()
! if( isDisposing )
! {
! _reader.Dispose();
! }
!
! // free unmanaged resources here
!
! _isAlreadyDisposed = true;
! // nothing for Finalizer to do - so tell the GC to ignore it
! GC.SuppressFinalize( this );
!
}
Index: NDataReader.cs
===================================================================
RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/NDataReader.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** NDataReader.cs 31 Dec 2004 17:25:35 -0000 1.5
--- NDataReader.cs 30 Jan 2005 19:36:15 -0000 1.6
***************
*** 172,176 ****
#region IDisposable Members
! /// <summary></summary>
public void Dispose()
{
--- 172,184 ----
#region IDisposable Members
! /// <summary>
! /// Takes care of freeing the managed and unmanaged resources that
! /// this class is responsible for.
! /// </summary>
! /// <remarks>
! /// There are not any unmanaged resources or any disposable managed
! /// resources that this class is holding onto. It is in here
! /// to comply with the <see cref="IDataReader"/> interface.
! /// </remarks>
public void Dispose()
{
|