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.DataReaderWrapper Class Reference

Wrapper class that implements a pass through version of IDataReader. Useful for various places where we need to wrap data readers for connection management. More...

Inheritance diagram for Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper:
Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper Microsoft.Practices.EnterpriseLibrary.Data.RefCountingDataReader Microsoft.Practices.EnterpriseLibrary.Data.Oracle.RefCountingOracleDataReaderWrapper

Public Member Functions

virtual void Close ()
 Closes the T:System.Data.IDataReader Object. More...
 
void Dispose ()
 Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. More...
 
virtual string GetName (int i)
 Gets the name for the field to find. More...
 
virtual string GetDataTypeName (int i)
 Gets the data type information for the specified field. More...
 
virtual Type GetFieldType (int i)
 Gets the T:System.Type information corresponding to the type of T:System.Object that would be returned from M:System.Data.IDataRecord.GetValue(System.Int32). More...
 
virtual object GetValue (int i)
 Return the value of the specified field. More...
 
virtual int GetValues (object[] values)
 Gets all the attribute fields in the collection for the current record. More...
 
virtual int GetOrdinal (string name)
 Return the index of the named field. More...
 
virtual bool GetBoolean (int i)
 Gets the value of the specified column as a Boolean. More...
 
virtual byte GetByte (int i)
 Gets the 8-bit unsigned integer value of the specified column. More...
 
virtual long GetBytes (int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
 Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset. More...
 
virtual char GetChar (int i)
 Gets the character value of the specified column. More...
 
virtual long GetChars (int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
 Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset. More...
 
virtual Guid GetGuid (int i)
 Returns the GUID value of the specified field. More...
 
virtual short GetInt16 (int i)
 Gets the 16-bit signed integer value of the specified field. More...
 
virtual int GetInt32 (int i)
 Gets the 32-bit signed integer value of the specified field. More...
 
virtual long GetInt64 (int i)
 Gets the 64-bit signed integer value of the specified field. More...
 
virtual float GetFloat (int i)
 Gets the single-precision floating point number of the specified field. More...
 
virtual double GetDouble (int i)
 Gets the double-precision floating point number of the specified field. More...
 
virtual string GetString (int i)
 Gets the string value of the specified field. More...
 
virtual decimal GetDecimal (int i)
 Gets the fixed-position numeric value of the specified field. More...
 
virtual DateTime GetDateTime (int i)
 Gets the date and time data value of the specified field. More...
 
virtual IDataReader GetData (int i)
 Returns an T:System.Data.IDataReader for the specified column ordinal. More...
 
virtual bool IsDBNull (int i)
 Return whether the specified field is set to null. More...
 
virtual DataTable GetSchemaTable ()
 Returns a T:System.Data.DataTable that describes the column metadata of the T:System.Data.IDataReader. More...
 
virtual bool NextResult ()
 Advances the data reader to the next result, when reading the results of batch SQL statements. More...
 
virtual bool Read ()
 Advances the T:System.Data.IDataReader to the next record. More...
 

Protected Member Functions

 DataReaderWrapper (IDataReader innerReader)
 Construct a new DataReaderWrapper that delegates all methods to the given innerReader . More...
 
virtual void Dispose (bool disposing)
 Close the contained data reader when disposing. More...
 

Properties

IDataReader InnerReader [get]
 The actual raw IDataReader we're wrapping. More...
 
virtual int FieldCount [get]
 Gets the number of columns in the current row. More...
 
virtual int Depth [get]
 Gets a value indicating the depth of nesting for the current row. More...
 
virtual bool IsClosed [get]
 Gets a value indicating whether the data reader is closed. More...
 
virtual int RecordsAffected [get]
 Gets the number of rows changed, inserted, or deleted by execution of the SQL statement. More...
 

Detailed Description

Wrapper class that implements a pass through version of IDataReader. Useful for various places where we need to wrap data readers for connection management.

Constructor & Destructor Documentation

◆ DataReaderWrapper()

Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.DataReaderWrapper ( IDataReader  innerReader)
protected

Construct a new DataReaderWrapper that delegates all methods to the given innerReader .

Parameters
innerReaderIDataReader to wrap.

Member Function Documentation

◆ Close()

virtual void Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.Close ( )
virtual

◆ Dispose() [1/2]

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

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

◆ Dispose() [2/2]

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

Close the contained data reader when disposing.

Parameters
disposingTrue if called from Dispose method, false if called from finalizer. Since this class doesn't have a finalizer, this will always be true.

Reimplemented in Microsoft.Practices.EnterpriseLibrary.Data.RefCountingDataReader, and Microsoft.Practices.EnterpriseLibrary.Data.Oracle.RefCountingOracleDataReaderWrapper.

◆ GetBoolean()

virtual bool Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetBoolean ( int  i)
virtual

Gets the value of the specified column as a Boolean.

Returns
The value of the column.
Parameters
iThe zero-based column ordinal.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

Reimplemented in Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper.

◆ GetByte()

virtual byte Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetByte ( int  i)
virtual

Gets the 8-bit unsigned integer value of the specified column.

Returns
The 8-bit unsigned integer value of the specified column.
Parameters
iThe zero-based column ordinal.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

Reimplemented in Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper.

◆ GetBytes()

virtual long Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetBytes ( int  i,
long  fieldOffset,
byte[]  buffer,
int  bufferoffset,
int  length 
)
virtual

Reads a stream of bytes from the specified column offset into the buffer as an array, starting at the given buffer offset.

Returns
The actual number of bytes read.
Parameters
iThe zero-based column ordinal.
fieldOffsetThe index within the field from which to start the read operation.
bufferThe buffer into which to read the stream of bytes.
bufferoffsetThe index for buffer to start the read operation.
lengthThe number of bytes to read.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetChar()

virtual char Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetChar ( int  i)
virtual

Gets the character value of the specified column.

Returns
The character value of the specified column.
Parameters
iThe zero-based column ordinal.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetChars()

virtual long Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetChars ( int  i,
long  fieldoffset,
char[]  buffer,
int  bufferoffset,
int  length 
)
virtual

Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.

Returns
The actual number of characters read.
Parameters
iThe zero-based column ordinal.
fieldoffsetThe index within the row from which to start the read operation.
bufferThe buffer into which to read the stream of bytes.
bufferoffsetThe index for buffer to start the read operation.
lengthThe number of bytes to read.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetData()

virtual IDataReader Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetData ( int  i)
virtual

Returns an T:System.Data.IDataReader for the specified column ordinal.

Returns
An T:System.Data.IDataReader.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetDataTypeName()

virtual string Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetDataTypeName ( int  i)
virtual

Gets the data type information for the specified field.

Returns
The data type information for the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetDateTime()

virtual DateTime Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetDateTime ( int  i)
virtual

Gets the date and time data value of the specified field.

Returns
The date and time data value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetDecimal()

virtual decimal Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetDecimal ( int  i)
virtual

Gets the fixed-position numeric value of the specified field.

Returns
The fixed-position numeric value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetDouble()

virtual double Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetDouble ( int  i)
virtual

Gets the double-precision floating point number of the specified field.

Returns
The double-precision floating point number of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetFieldType()

virtual Type Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetFieldType ( int  i)
virtual

Gets the T:System.Type information corresponding to the type of T:System.Object that would be returned from M:System.Data.IDataRecord.GetValue(System.Int32).

Returns
The T:System.Type information corresponding to the type of T:System.Object that would be returned from M:System.Data.IDataRecord.GetValue(System.Int32).
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetFloat()

virtual float Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetFloat ( int  i)
virtual

Gets the single-precision floating point number of the specified field.

Returns
The single-precision floating point number of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetGuid()

virtual Guid Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetGuid ( int  i)
virtual

Returns the GUID value of the specified field.

Returns
The GUID value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

Reimplemented in Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper.

◆ GetInt16()

virtual short Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetInt16 ( int  i)
virtual

Gets the 16-bit signed integer value of the specified field.

Returns
The 16-bit signed integer value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

Reimplemented in Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper.

◆ GetInt32()

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetInt32 ( int  i)
virtual

Gets the 32-bit signed integer value of the specified field.

Returns
The 32-bit signed integer value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetInt64()

virtual long Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetInt64 ( int  i)
virtual

Gets the 64-bit signed integer value of the specified field.

Returns
The 64-bit signed integer value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetName()

virtual string Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetName ( int  i)
virtual

Gets the name for the field to find.

Returns
The name of the field or the empty string (""), if there is no value to return.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetOrdinal()

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetOrdinal ( string  name)
virtual

Return the index of the named field.

Returns
The index of the named field.
Parameters
nameThe name of the field to find.

◆ GetSchemaTable()

virtual DataTable Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetSchemaTable ( )
virtual

Returns a T:System.Data.DataTable that describes the column metadata of the T:System.Data.IDataReader.

Returns
A T:System.Data.DataTable that describes the column metadata.
Exceptions
T:System.InvalidOperationExceptionThe T:System.Data.IDataReader is closed.

◆ GetString()

virtual string Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetString ( int  i)
virtual

Gets the string value of the specified field.

Returns
The string value of the specified field.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetValue()

virtual object Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetValue ( int  i)
virtual

Return the value of the specified field.

Returns
The T:System.Object which will contain the field value upon return.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ GetValues()

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.GetValues ( object[]  values)
virtual

Gets all the attribute fields in the collection for the current record.

Returns
The number of instances of T:System.Object in the array.
Parameters
valuesAn array of T:System.Object to copy the attribute fields into.

◆ IsDBNull()

virtual bool Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.IsDBNull ( int  i)
virtual

Return whether the specified field is set to null.

Returns
true if the specified field is set to null; otherwise, false.
Parameters
iThe index of the field to find.
Exceptions
T:System.IndexOutOfRangeExceptionThe index passed was outside the range of 0 through P:System.Data.IDataRecord.FieldCount.

◆ NextResult()

virtual bool Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.NextResult ( )
virtual

Advances the data reader to the next result, when reading the results of batch SQL statements.

Returns
true if there are more rows; otherwise, false.

◆ Read()

virtual bool Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.Read ( )
virtual

Advances the T:System.Data.IDataReader to the next record.

Returns
true if there are more rows; otherwise, false.

Property Documentation

◆ Depth

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.Depth
get

Gets a value indicating the depth of nesting for the current row.

Returns
The level of nesting.

◆ FieldCount

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.FieldCount
get

Gets the number of columns in the current row.

Returns
When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record. The default is -1.

◆ InnerReader

IDataReader Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.InnerReader
get

The actual raw IDataReader we're wrapping.

◆ IsClosed

virtual bool Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.IsClosed
get

Gets a value indicating whether the data reader is closed.

Returns
true if the data reader is closed; otherwise, false.

◆ RecordsAffected

virtual int Microsoft.Practices.EnterpriseLibrary.Data.DataReaderWrapper.RecordsAffected
get

Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.

Returns
The number of rows changed, inserted, or deleted; 0 if no rows were affected or the statement failed; and -1 for SELECT statements.

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