Show / Hide Table of Contents

Class BaseDataReader

Reads a forward-only stream of rows.

Inheritance
Object
BaseDataReader
BaseMappingDataReader<TDestination>
CsvDataReader
GenericListDataReader<T>
Inherited Members
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
Namespace: IRM.Data
Assembly: IRM.dll
Syntax
public abstract class BaseDataReader : IDataReader, IDisposable, IDataRecord

Constructors

BaseDataReader()

Initializes a new instance of the BaseDataReader class.

Declaration
protected BaseDataReader()

BaseDataReader(Boolean)

Initializes a new instance of the BaseDataReader class.

Declaration
protected BaseDataReader(bool parseToDefinedType)
Parameters
Boolean parseToDefinedType

Properties

Depth

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

Declaration
public int Depth { get; }
Property Value
System.Int32

The level of nesting.

Implements
System.Data.IDataReader.Depth

FieldCount

Gets the number of columns in the current row.

Declaration
public abstract int FieldCount { get; }
Property Value
System.Int32

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

Implements
IDataRecord.FieldCount

IsClosed

Gets a value indicating whether the data reader is closed.

Declaration
public abstract bool IsClosed { get; }
Property Value
Boolean

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

Implements
System.Data.IDataReader.IsClosed

IsDisposed

Gets a value indicating whether the instance has been disposed of.

Declaration
[Browsable(false)]
public bool IsDisposed { get; }
Property Value
Boolean

true if the instance has been disposed of; otherwise, false.

Item[Int32]

Gets the value of the column located at the specified index as a string.

Declaration
public abstract string this[int index] { get; }
Parameters
System.Int32 index

The zero-based index of the column to get.

Property Value
String

The value of the column located at the specified index as a string

Item[String]

Gets the value of the column with the specified name as a string.

Declaration
public abstract string this[string name] { get; }
Parameters
String name

The name of the column to find.

Property Value
String

The value of the column with the specified name as a string.

RecordsAffected

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

Declaration
public int RecordsAffected { get; }
Property Value
System.Int32

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

Implements
System.Data.IDataReader.RecordsAffected

Methods

CheckDisposed()

Checks if the instance has been disposed of, and if it has, throws an System.ObjectDisposedException; otherwise, does nothing.

Declaration
protected void CheckDisposed()
Remarks

Derived classes should call this method at the start of all methods and properties that should not be accessed after a call to Dispose().

Exceptions
System.ObjectDisposedException

The instance has been disposed of.

Close()

Closes the System.Data.IDataReader Object.

Declaration
public virtual void Close()
Implements
IDataReader.Close()

Dispose()

Releases all resources used by the instance.

Declaration
public void Dispose()
Implements
System.IDisposable.Dispose()
Remarks

Calls Dispose(Boolean) with the disposing parameter set to true to free unmanaged and managed resources.

Dispose(Boolean)

Releases the unmanaged resources used by this instance and optionally releases the managed resources.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Boolean disposing

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Finalize()

Finalizes an instance of the of the BaseDataReader class.

Declaration
protected void Finalize()

GetBoolean(Int32)

Gets the value of the specified column as a Boolean.

Declaration
public virtual bool GetBoolean(int i)
Parameters
System.Int32 i

The zero-based column ordinal.

Returns
Boolean

The value of the column.

Implements
System.Data.IDataRecord.GetBoolean(System.Int32)

GetByte(Int32)

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

Declaration
public virtual byte GetByte(int i)
Parameters
System.Int32 i

The zero-based column ordinal.

Returns
System.Byte

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

Implements
System.Data.IDataRecord.GetByte(System.Int32)

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

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

Declaration
public virtual long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
Parameters
System.Int32 i

The zero-based column ordinal.

System.Int64 fieldOffset

The index within the field from which to start the read operation.

System.Byte[] buffer

The buffer into which to read the stream of bytes.

System.Int32 bufferoffset

The index for buffer to start the read operation.

System.Int32 length

The number of bytes to read.

Returns
System.Int64

The actual number of bytes read.

Implements
System.Data.IDataRecord.GetBytes(System.Int32, System.Int64, System.Byte[], System.Int32, System.Int32)

GetChar(Int32)

Gets the character value of the specified column.

Declaration
public virtual char GetChar(int i)
Parameters
System.Int32 i

The zero-based column ordinal.

Returns
Char

The character value of the specified column.

Implements
IDataRecord.GetChar(Int32)

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

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

Declaration
public virtual long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
Parameters
System.Int32 i

The zero-based column ordinal.

System.Int64 fieldoffset

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

Char[] buffer

The buffer into which to read the stream of bytes.

System.Int32 bufferoffset

The index for buffer to start the read operation.

System.Int32 length

The number of bytes to read.

Returns
System.Int64

The actual number of characters read.

Implements
System.Data.IDataRecord.GetChars(System.Int32, System.Int64, System.Char[], System.Int32, System.Int32)

GetData(Int32)

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

Declaration
public virtual IDataReader GetData(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Data.IDataReader

The System.Data.IDataReader for the specified column ordinal.

Implements
System.Data.IDataRecord.GetData(System.Int32)

GetDataTypeName(Int32)

Gets the data type information for the specified field.

Declaration
public virtual string GetDataTypeName(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
String

The data type information for the specified field.

Implements
System.Data.IDataRecord.GetDataTypeName(System.Int32)

GetDateTime(Int32)

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

Declaration
public virtual DateTime GetDateTime(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.DateTime

The date and time data value of the specified field.

Implements
System.Data.IDataRecord.GetDateTime(System.Int32)

GetDecimal(Int32)

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

Declaration
public virtual decimal GetDecimal(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Decimal

The fixed-position numeric value of the specified field.

Implements
System.Data.IDataRecord.GetDecimal(System.Int32)

GetDouble(Int32)

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

Declaration
public virtual double GetDouble(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Double

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

Implements
IDataRecord.GetDouble(Int32)

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).

Declaration
public abstract Type GetFieldType(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Type

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

Implements
IDataRecord.GetFieldType(Int32)

GetFloat(Int32)

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

Declaration
public virtual float GetFloat(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Single

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

Implements
System.Data.IDataRecord.GetFloat(System.Int32)

GetGuid(Int32)

Returns the GUID value of the specified field.

Declaration
public virtual Guid GetGuid(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Guid

The GUID value of the specified field.

Implements
System.Data.IDataRecord.GetGuid(System.Int32)

GetInt16(Int32)

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

Declaration
public virtual short GetInt16(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Int16

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

Implements
System.Data.IDataRecord.GetInt16(System.Int32)

GetInt32(Int32)

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

Declaration
public virtual int GetInt32(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Int32

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

Implements
System.Data.IDataRecord.GetInt32(System.Int32)

GetInt64(Int32)

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

Declaration
public virtual long GetInt64(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Int64

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

Implements
IDataRecord.GetInt64(Int32)

GetName(Int32)

Gets the name for the field to find.

Declaration
public abstract string GetName(int i)
Parameters
System.Int32 i

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.

Implements
System.Data.IDataRecord.GetName(System.Int32)

GetNullableInt32(Int32)

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

Declaration
public int? GetNullableInt32(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
System.Nullable<System.Int32>

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

GetOrdinal(String)

Return the index of the named field.

Declaration
public abstract int GetOrdinal(string name)
Parameters
String name

The name of the field to find.

Returns
System.Int32

The index of the named field.

Implements
System.Data.IDataRecord.GetOrdinal(System.String)

GetSchemaTable()

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

Declaration
public virtual DataTable GetSchemaTable()
Returns
System.Data.DataTable

A System.Data.DataTable that describes the column metadata.

Implements
System.Data.IDataReader.GetSchemaTable()

GetString(Int32)

Gets the string value of the specified field.

Declaration
public virtual string GetString(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
String

The string value of the specified field.

Implements
System.Data.IDataRecord.GetString(System.Int32)

GetValue(Int32)

Return the value of the specified field.

Declaration
public virtual object GetValue(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
Object

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

Implements
IDataRecord.GetValue(Int32)

GetValues(Object[])

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

Declaration
public virtual int GetValues(object[] values)
Parameters
Object[] values

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

Returns
System.Int32

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

Implements
IDataRecord.GetValues(Object[])

IsDBNull(Int32)

Return whether the specified field is set to null.

Declaration
public virtual bool IsDBNull(int i)
Parameters
System.Int32 i

The index of the field to find.

Returns
Boolean

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

Implements
System.Data.IDataRecord.IsDBNull(System.Int32)

NextResult()

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

Declaration
public virtual bool NextResult()
Returns
Boolean

true if there are more results; otherwise, false.

Implements
System.Data.IDataReader.NextResult()

OnDisposed(EventArgs)

Raises the Disposed event.

Declaration
protected virtual void OnDisposed(EventArgs e)
Parameters
System.EventArgs e

A System.EventArgs that contains the event data.

Read()

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

Declaration
public abstract bool Read()
Returns
Boolean

true if there are more rows; otherwise, false.

Implements
System.Data.IDataReader.Read()

Events

Disposed

Occurs when the instance is disposed of.

Declaration
public event EventHandler Disposed
Event Type
System.EventHandler

Explicit Interface Implementations

IDataRecord.Item[Int32]

Gets the value value of the column located at the specified index as an System.Object.

Declaration
object IDataRecord.this[int index] { get; }
Parameters
System.Int32 index

The zero-based index of the column to get.

Returns
Object

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

Implements
System.Data.IDataRecord.Item[System.Int32]

IDataRecord.Item[String]

Gets the value of the column with the specified name as an System.Object.

Declaration
object IDataRecord.this[string name] { get; }
Parameters
String name

The name of the column to find.

Returns
Object

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

Implements
System.Data.IDataRecord.Item[System.String]

Extension Methods

ObjectExtensions.DeepClone<T>(T)
DataReaderExtensions.ReadAs<T>(IDataReader, Func<IDataRecord, T>)
DataReaderExtensions.ReadAs<T>(IDataReader, Func<IDataRecord, T>, Action<T>)
DataRecordExtensions.Parse<T>(IDataRecord, Int32, Func<IDataRecord, Int32, T>)
DataRecordExtensions.Parse<T>(IDataRecord, String, Func<IDataRecord, String, T>)
DataRecordExtensions.ParsePersonnummer(IDataRecord, Int32)
DataRecordExtensions.ParseBoolean(IDataRecord, Int32)
DataRecordExtensions.ParseBoolean(IDataRecord, String)
DataRecordExtensions.ParseBooleanValueFromZeroOrOne(IDataRecord, Int32)
DataRecordExtensions.ParseNullableBoolean(IDataRecord, Int32)
DataRecordExtensions.ParseNullableBoolean(IDataRecord, String)
DataRecordExtensions.ParseDateTime(IDataRecord, Int32, String)
DataRecordExtensions.ParseDateTime(IDataRecord, Int32)
DataRecordExtensions.ParseDateTime(IDataRecord, Int32, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDateTime(IDataRecord, String)
DataRecordExtensions.ParseDateTime(IDataRecord, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDateTimeExact(IDataRecord, Int32, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDateTimeExact(IDataRecord, Int32, String[], IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDateTimeExact(IDataRecord, String, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDateTimeExact(IDataRecord, String, String[], IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTime(IDataRecord, Int32)
DataRecordExtensions.ParseNullableDateTime(IDataRecord, Int32, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTime(IDataRecord, String)
DataRecordExtensions.ParseNullableDateTime(IDataRecord, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTimeExact(IDataRecord, Int32, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTimeExact(IDataRecord, Int32, String[], IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTimeExact(IDataRecord, String, String, IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseNullableDateTimeExact(IDataRecord, String, String[], IFormatProvider, DateTimeStyles)
DataRecordExtensions.ParseDecimal(IDataRecord, Int32)
DataRecordExtensions.ParseDecimal(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseDecimal(IDataRecord, String)
DataRecordExtensions.ParseDecimal(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableDecimal(IDataRecord, Int32)
DataRecordExtensions.ParseNullableDecimal(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableDecimal(IDataRecord, String)
DataRecordExtensions.ParseNullableDecimal(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseDouble(IDataRecord, Int32)
DataRecordExtensions.ParseDouble(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseDouble(IDataRecord, String)
DataRecordExtensions.ParseDouble(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableDouble(IDataRecord, Int32)
DataRecordExtensions.ParseNullableDouble(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableDouble(IDataRecord, String)
DataRecordExtensions.ParseNullableDouble(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseInt(IDataRecord, Int32)
DataRecordExtensions.ParseInt(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseInt(IDataRecord, String)
DataRecordExtensions.ParseInt(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableInt(IDataRecord, Int32)
DataRecordExtensions.ParseNullableInt(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableInt(IDataRecord, String)
DataRecordExtensions.ParseNullableInt(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseLong(IDataRecord, Int32)
DataRecordExtensions.ParseLong(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseLong(IDataRecord, String)
DataRecordExtensions.ParseLong(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableLong(IDataRecord, Int32)
DataRecordExtensions.ParseNullableLong(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableLong(IDataRecord, String)
DataRecordExtensions.ParseNullableLong(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseShort(IDataRecord, Int32)
DataRecordExtensions.ParseShort(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseShort(IDataRecord, String)
DataRecordExtensions.ParseShort(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableShort(IDataRecord, Int32)
DataRecordExtensions.ParseNullableShort(IDataRecord, Int32, NumberStyles, IFormatProvider)
DataRecordExtensions.ParseNullableShort(IDataRecord, String)
DataRecordExtensions.ParseNullableShort(IDataRecord, String, NumberStyles, IFormatProvider)
DataRecordExtensions.GetValue<TType>(IDataRecord, String, Boolean)
DataRecordExtensions.GetValue<TType>(IDataRecord, Int32, Boolean)
AnnotationsExtensions.IsValid(Object)
Back to top Generated by DocFX