Class StringDataReader
Provides a generic way of reading a forward-only stream of rows from a System.String based data source. This is an abstract class.
Inheritance
Implements
Inherited Members
Namespace: Cuemon.Data
Assembly: Cuemon.Data.dll
Syntax
public abstract class StringDataReader : DbDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable
Constructors
| Improve this DocStringDataReader()
Initializes a new instance of the StringDataReader class.
Declaration
protected StringDataReader()
StringDataReader(Func<String, Object>)
Initializes a new instance of the StringDataReader class.
Declaration
protected StringDataReader(Func<string, object> parser)
Parameters
Type | Name | Description |
---|---|---|
System.Func<System.String, System.Object> | parser | The function delegate that returns a primitive object whose value is equivalent to the provided System.String value. |
Remarks
The default implementation uses FromString(String) as parser
.
Properties
| Improve this DocDepth
Gets a value indicating the depth of nesting for the current row.
Declaration
public override int Depth { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The level of nesting. |
Overrides
FieldCount
Gets the number of columns in the current row.
Declaration
public override int FieldCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record. |
Overrides
IsClosed
Gets a value indicating whether the data reader is closed.
Declaration
public override bool IsClosed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
IsDisposed
Gets a value indicating whether this instance is disposed.
Declaration
protected bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Item[Int32]
Gets the column located at the specified index.
Declaration
public override object this[int i] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based index of the column to get. |
Property Value
Type | Description |
---|---|
System.Object | The column located at the specified index as an System.Object. |
Overrides
Item[String]
Gets the column with the specified name.
Declaration
public override object this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the column to find. |
Property Value
Type | Description |
---|---|
System.Object | The column with the specified name as an System.Object. |
Overrides
RecordsAffected
Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
Declaration
public override int RecordsAffected { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The records affected. |
Overrides
RowCount
Gets the currently processed row count of this instance.
Declaration
public int RowCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The currently processed row count of this instance. |
Remarks
This property is incremented when the invoked Read() method returns true
.
StringParser
Gets a reference to the function delegate that returns a primitive object whose value is equivalent to the provided System.String value.
Declaration
protected Func<string, object> StringParser { get; }
Property Value
Type | Description |
---|---|
System.Func<System.String, System.Object> | A reference to the function delegate that this instance was constructed with. |
Methods
| Improve this DocContains(String)
Determines whether this instance contains a column with the specified name.
Declaration
public bool Contains(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the column to find. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Overrides
GetBoolean(Int32)
Gets the value of the specified column as a Boolean.
Declaration
public override bool GetBoolean(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
Returns
Type | Description |
---|---|
System.Boolean | The value of the column. |
Overrides
GetByte(Int32)
Gets the 8-bit unsigned integer value of the specified column.
Declaration
public override byte GetByte(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
Returns
Type | Description |
---|---|
System.Byte | The 8-bit unsigned integer value of the specified column. |
Overrides
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.
Declaration
public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
System.Int64 | fieldOffset | The index within the row from which to begin the read operation. |
System.Byte[] | buffer | The buffer into which to copy the data. |
System.Int32 | bufferoffset | The index with the buffer to which the data will be copied. |
System.Int32 | length | The maximum number of characters to read. |
Returns
Type | Description |
---|---|
System.Int64 | The actual number of bytes read. |
Overrides
GetChar(Int32)
Gets the character value of the specified column.
Declaration
public override char GetChar(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
Returns
Type | Description |
---|---|
System.Char | The character value of the specified column. |
Overrides
GetChars(Int32, Int64, Char[], Int32, Int32)
Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into the buffer, starting at the location indicated by bufferOffset.
Declaration
public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
System.Int64 | fieldoffset | The index within the row from which to begin the read operation. |
System.Char[] | buffer | The buffer into which to copy the data. |
System.Int32 | bufferoffset | The index with the buffer to which the data will be copied. |
System.Int32 | length | The maximum number of characters to read. |
Returns
Type | Description |
---|---|
System.Int64 | The actual number of characters read. |
Overrides
GetDataTypeName(Int32)
Gets the name of the data type.
Declaration
public override string GetDataTypeName(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The zero-based column ordinal. |
Returns
Type | Description |
---|---|
System.String | System.String. |
Overrides
GetDateTime(Int32)
Gets the date and time data value of the specified field.
Declaration
public override DateTime GetDateTime(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.DateTime | The date and time data value of the specified field. |
Overrides
GetDecimal(Int32)
Gets the fixed-position numeric value of the specified field.
Declaration
public override decimal GetDecimal(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Decimal | The fixed-position numeric value of the specified field. |
Overrides
GetDouble(Int32)
Gets the double-precision floating point number of the specified field.
Declaration
public override double GetDouble(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Double | The double-precision floating point number of the specified field. |
Overrides
GetEnumerator()
Returns an System.Collections.IEnumerator that can be used to iterate through the rows in the data reader.
Declaration
public override IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator that can be used to iterate through the rows in the data reader. |
Overrides
Exceptions
Type | Condition |
---|---|
System.NotImplementedException |
GetFieldType(Int32)
Gets the System.Type information corresponding to the type of System.Object that would be returned from System.Data.IDataRecord.GetValue(Int32).
Declaration
public override Type GetFieldType(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Type | The System.Type information corresponding to the type of System.Object that would be returned from System.Data.IDataRecord.GetValue(Int32). |
Overrides
GetFloat(Int32)
Gets the single-precision floating point number of the specified field.
Declaration
public override float GetFloat(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Single | The single-precision floating point number of the specified field. |
Overrides
GetGuid(Int32)
Returns the GUID value of the specified field.
Declaration
public override Guid GetGuid(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Guid | The GUID value of the specified field. |
Overrides
GetInt16(Int32)
Gets the 16-bit signed integer value of the specified field.
Declaration
public override short GetInt16(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Int16 | The 16-bit signed integer value of the specified field. |
Overrides
GetInt32(Int32)
Gets the 32-bit signed integer value of the specified field.
Declaration
public override int GetInt32(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Int32 | The 32-bit signed integer value of the specified field. |
Overrides
GetInt64(Int32)
Gets the 64-bit signed integer value of the specified field.
Declaration
public override long GetInt64(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Int64 | The 64-bit signed integer value of the specified field. |
Overrides
GetName(Int32)
Gets the name for the field to find.
Declaration
public override string GetName(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.String | The name of the field or the empty string (""), if there is no value to return. |
Overrides
GetOrdinal(String)
Return the index of the named field.
Declaration
public override int GetOrdinal(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the field to find. |
Returns
Type | Description |
---|---|
System.Int32 | The index of the named field. |
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentOutOfRangeException |
|
GetString(Int32)
Gets the string value of the specified field.
Declaration
public override string GetString(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.String | The string value of the specified field. |
Overrides
GetValue(Int32)
Return the value of the specified field.
Declaration
public override object GetValue(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Object | The System.Object which will contain the field value upon return. |
Overrides
GetValues(Object[])
Populates an array of objects with the column values of the current record.
Declaration
public override int GetValues(object[] values)
Parameters
Type | Name | Description |
---|---|---|
System.Object[] | values | An array of System.Object to copy the attribute fields into. |
Returns
Type | Description |
---|---|
System.Int32 | The number of instances of System.Object in the array. |
Overrides
IsDBNull(Int32)
Return whether the specified field is set to null.
Declaration
public override bool IsDBNull(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | The index of the field to find. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified field is set to null; otherwise, false. |
Overrides
NextResult()
Advances the reader to the next result when reading the results of a batch of statements.
Declaration
public override bool NextResult()
Returns
Type | Description |
---|---|
System.Boolean | true if there are more result sets; otherwise false. |
Overrides
Read()
Advances the System.Data.DbDataReader to the next record.
Declaration
public override bool Read()
Returns
Type | Description |
---|---|
System.Boolean |
|
Overrides
ReadNext()
Advances the System.Data.DbDataReader to the next record.
Declaration
protected abstract bool ReadNext()
Returns
Type | Description |
---|---|
System.Boolean |
|
SetFields(IOrderedDictionary)
Sets the fields of the current record invoked by ReadNext().
Declaration
protected void SetFields(IOrderedDictionary fields)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Specialized.IOrderedDictionary | fields | The fields of the current record invoked by ReadNext(). |
ToString()
Returns a System.String that represents the current row of this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents the current row of this instance. |