Table of Contents

Class DataReader<TRead>

Namespace
Cuemon.Data
Assembly
Cuemon.Data.dll

Provides a generic way of reading a forward-only stream of rows from a TRead based data source. This is an abstract class.

public abstract class DataReader<TRead> : Disposable, IDataReader, IDataRecord, IDisposable

Type Parameters

TRead

The type of the value that this System.Data.IDataReader will read.

Inheritance
Object
DataReader<TRead>
Implements
IDataReader
IDataRecord
IDisposable
Derived
Inherited Members

Constructors

DataReader()

Initializes a new instance of the DataReader<TRead> class.

protected DataReader()

Properties

Depth

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

public virtual int Depth { get; }

Property Value

Int32

The level of nesting.

FieldCount

Gets the number of columns in the current row.

public int FieldCount { get; }

Property Value

Int32

When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record.

Item[Int32]

Gets the column located at the specified index.

public object this[int i] { get; }

Parameters

i Int32

The zero-based index of the column to get.

Property Value

Object

The column located at the specified index as an System.Object.

Item[String]

Gets the column with the specified name.

public object this[string name] { get; }

Parameters

name String

The name of the column to find.

Property Value

Object

The column with the specified name as an System.Object.

NullRead

Gets the value that indicates that no more rows exists.

protected abstract TRead NullRead { get; }

Property Value

TRead

The value that indicates that no more rows exists.

RowCount

Gets the currently processed row count of this instance.

public abstract int RowCount { get; protected set; }

Property Value

Int32

The currently processed row count of this instance.

Methods

Contains(String)

Determines whether this instance contains a column with the specified name.

public bool Contains(string name)

Parameters

name String

The name of the column to find.

Returns

Boolean

true if this instance contains a column with the specified name; otherwise, false.

GetBoolean(Int32)

Gets the value of the specified column as a Boolean.

public bool GetBoolean(int i)

Parameters

i Int32

The zero-based column ordinal.

Returns

Boolean

The value of the column.

GetByte(Int32)

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

public byte GetByte(int i)

Parameters

i Int32

The zero-based column ordinal.

Returns

Byte

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

GetBytes(Int32, Int64, Byte[], Int32, Int32)

Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the buffer, starting at the location indicated by bufferOffset.

public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)

Parameters

i Int32

The zero-based column ordinal.

fieldOffset Int64

The index within the row from which to begin the read operation.

buffer Byte[]

The buffer into which to copy the data.

bufferoffset Int32

The index with the buffer to which the data will be copied.

length Int32

The maximum number of characters to read.

Returns

Int64

The actual number of bytes read.

GetChar(Int32)

Gets the character value of the specified column.

public char GetChar(int i)

Parameters

i Int32

The zero-based column ordinal.

Returns

Char

The character value of the specified column.

GetDateTime(Int32)

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

public DateTime GetDateTime(int i)

Parameters

i Int32

The index of the field to find.

Returns

DateTime

The date and time data value of the specified field.

GetDecimal(Int32)

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

public decimal GetDecimal(int i)

Parameters

i Int32

The index of the field to find.

Returns

Decimal

The fixed-position numeric value of the specified field.

GetDouble(Int32)

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

public double GetDouble(int i)

Parameters

i Int32

The index of the field to find.

Returns

Double

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

GetFieldType(Int32)

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

public Type GetFieldType(int i)

Parameters

i Int32

The index of the field to find.

Returns

Type

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

GetFloat(Int32)

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

public float GetFloat(int i)

Parameters

i Int32

The index of the field to find.

Returns

Single

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

GetGuid(Int32)

Returns the GUID value of the specified field.

public Guid GetGuid(int i)

Parameters

i Int32

The index of the field to find.

Returns

Guid

The GUID value of the specified field.

GetInt16(Int32)

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

public short GetInt16(int i)

Parameters

i Int32

The index of the field to find.

Returns

Int16

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

GetInt32(Int32)

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

public int GetInt32(int i)

Parameters

i Int32

The index of the field to find.

Returns

Int32

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

GetInt64(Int32)

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

public long GetInt64(int i)

Parameters

i Int32

The index of the field to find.

Returns

Int64

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

GetName(Int32)

Gets the name for the field to find.

public string GetName(int i)

Parameters

i Int32

The index of the field to find.

Returns

String

The name of the field or the empty string (""), if there is no value to return.

GetOrdinal(String)

Return the index of the named field.

public int GetOrdinal(string name)

Parameters

name String

The name of the field to find.

Returns

Int32

The index of the named field.

Exceptions

System.ArgumentNullException

name is null.

ArgumentOutOfRangeException

name is not a valid column name.

GetString(Int32)

Gets the string value of the specified field.

public string GetString(int i)

Parameters

i Int32

The index of the field to find.

Returns

String

The string value of the specified field.

GetValue(Int32)

Return the value of the specified field.

public object GetValue(int i)

Parameters

i Int32

The index of the field to find.

Returns

Object

The System.Object which will contain the field value upon return.

GetValues(Object[])

Populates an array of objects with the column values of the current record.

public int GetValues(object[] values)

Parameters

values Object[]

An array of System.Object to copy the attribute fields into.

Returns

Int32

The number of instances of System.Object in the array.

IsDBNull(Int32)

Return whether the specified field is set to null.

public bool IsDBNull(int i)

Parameters

i Int32

The index of the field to find.

Returns

Boolean

true if the specified field is set to null; otherwise, false.

Read()

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

public abstract bool Read()

Returns

Boolean

true if there are more rows; otherwise, false.

ReadNext(TRead)

Advances the IDataReader to the next record.

protected abstract TRead ReadNext(TRead columns)

Parameters

columns TRead

Returns

TRead

TRead for as long as there are rows; NullRead when no more rows exists.

SetFields(IOrderedDictionary)

Sets the fields of the current record invoked by ReadNext(TRead).

protected void SetFields(IOrderedDictionary fields)

Parameters

fields IOrderedDictionary

The fields of the current record invoked by ReadNext(TRead).

ToString()

Returns a System.String that represents the current row of this instance.

public override string ToString()

Returns

String

A System.String that represents the current row of this instance.

Explicit Interface Implementations

IDataReader.Close()

void IDataReader.Close()

IDataReader.GetSchemaTable()

DataTable IDataReader.GetSchemaTable()

Returns

DataTable

IDataReader.IsClosed

bool IDataReader.IsClosed { get; }

Returns

Boolean

IDataReader.NextResult()

bool IDataReader.NextResult()

Returns

Boolean

IDataReader.RecordsAffected

int IDataReader.RecordsAffected { get; }

Returns

Int32

IDataRecord.GetChars(Int32, Int64, Char[], Int32, Int32)

long IDataRecord.GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)

Parameters

i Int32
fieldoffset Int64
buffer Char[]
bufferoffset Int32
length Int32

Returns

Int64

IDataRecord.GetData(Int32)

IDataReader IDataRecord.GetData(int i)

Parameters

i Int32

Returns

IDataReader

IDataRecord.GetDataTypeName(Int32)

string IDataRecord.GetDataTypeName(int i)

Parameters

i Int32

Returns

String

See Also

Disposable
IDataReader