System.Data.Common.DbDataAdapter.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // release mananged objects
                IDbDataAdapter pthis = this; // must cast to interface to obtain correct value
                pthis.SelectCommand = null;
                pthis.InsertCommand = null;
                pthis.UpdateCommand = null;
                pthis.DeleteCommand = null;
            }
            // release unmanaged objects

            base.Dispose(disposing); // notify base classes
        }

Usage Example

Ejemplo n.º 1
0
 /// <summary>
 /// Disposes any resources that have been created.
 /// </summary>
 public void Dispose()
 {
     if (_dataAdapter != null)
     {
         _dataAdapter.Dispose();
     }
     if (_commandBuilder != null)
     {
         _commandBuilder.Dispose();
     }
     if (_selectCommand != null)
     {
         _selectCommand.Dispose();
     }
     if (_insertCommand != null)
     {
         _insertCommand.Dispose();
     }
     if (_updateCommand != null)
     {
         _updateCommand.Dispose();
     }
     if (_deleteCommand != null)
     {
         _deleteCommand.Dispose();
     }
 }
All Usage Examples Of System.Data.Common.DbDataAdapter::Dispose