Class BulkCopyDataReader
- Namespace
- Cuemon.Data
- Assembly
- Cuemon.Data.dll
Provides a way of copying an existing object implementing the System.Data.Common.DbDataReader class to a filtered forward-only stream of rows that is mapped for bulk upload. This class cannot be inherited.
public sealed class BulkCopyDataReader : DbDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable, IAsyncDisposable
- Inheritance
-
ObjectMarshalByRefObjectDbDataReaderBulkCopyDataReader
- Implements
-
IEnumerableIDataReaderIDataRecordIDisposableIAsyncDisposable
- Inherited Members
-
DbDataReader.Close()DbDataReader.CloseAsync()DbDataReader.DisposeAsync()DbDataReader.GetDbDataReader(Int32)DbDataReader.GetFieldValueAsync<T>(Int32)DbDataReader.GetFieldValueAsync<T>(Int32, CancellationToken)DbDataReader.GetFieldValue<T>(Int32)DbDataReader.GetSchemaTable()DbDataReader.GetSchemaTableAsync(CancellationToken)DbDataReader.GetColumnSchemaAsync(CancellationToken)DbDataReader.GetStream(Int32)DbDataReader.GetTextReader(Int32)DbDataReader.IsDBNullAsync(Int32)DbDataReader.IsDBNullAsync(Int32, CancellationToken)DbDataReader.NextResultAsync()DbDataReader.NextResultAsync(CancellationToken)DbDataReader.ReadAsync()DbDataReader.ReadAsync(CancellationToken)DbDataReader.IDataRecord.GetData(Int32)DbDataReader.VisibleFieldCountMarshalByRefObject.GetLifetimeService()MarshalByRefObject.InitializeLifetimeService()MarshalByRefObject.MemberwiseClone(Boolean)
Constructors
BulkCopyDataReader(DbDataReader, IEnumerable<Mapping>)
Initializes a new instance of the BulkCopyDataReader class.
public BulkCopyDataReader(DbDataReader reader, IEnumerable<Mapping> mappings)
Parameters
reader
DbDataReaderThe System.Data.Common.DbDataReader object that contains the data.
mappings
IEnumerable<Mapping>A sequence of Mapping elements that specifies the data to be copied.
Properties
Depth
Gets a value indicating the depth of nesting for the current row.
public override int Depth { get; }
Property Value
- Int32
The depth of nesting for the current row.
Remarks
The outermost table has a depth of zero.
FieldCount
Gets the number of columns in the current row.
public override int FieldCount { get; }
Property Value
- Int32
When not positioned in a valid recordset, 0; otherwise, the number of columns in the current record.
HasRows
Gets a value that indicates whether this System.Data.Common.DbDataReader contains one or more rows.
public override bool HasRows { get; }
Property Value
- Boolean
true
if this instance has rows; otherwise,false
.
IsClosed
Gets a value indicating whether the data reader is closed.
public override bool IsClosed { get; }
Property Value
- Boolean
true
if this instance is closed; otherwise,false
.
Item[Int32]
Gets the column located at the specified index.
public override object this[int i] { get; }
Parameters
i
Int32The 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 override object this[string name] { get; }
Parameters
name
StringThe name of the column to find.
Property Value
- Object
The column with the specified name as an System.Object.
Mappings
Gets the sequence of Mapping elements that specifies the data to be copied.
public IList<Mapping> Mappings { get; }
Property Value
RecordsAffected
Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
public override int RecordsAffected { get; }
Property Value
- Int32
The records affected.
RowCount
Gets the currently processed row count of this instance.
public int RowCount { get; }
Property Value
- Int32
The currently processed row count of this instance.
Remarks
This property is incremented when the invoked Read() method returns true
.
Methods
Dispose(Boolean)
Releases the managed resources used by the System.Data.Common.DbDataReader and optionally releases the unmanaged resources.
protected override void Dispose(bool disposing)
Parameters
disposing
Booleantrue to release managed and unmanaged resources; false to release only unmanaged resources.
GetBoolean(Int32)
Gets the value of the specified column as a Boolean.
public override bool GetBoolean(int ordinal)
Parameters
ordinal
Int32The 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 override byte GetByte(int ordinal)
Parameters
ordinal
Int32The 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 override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
Parameters
ordinal
Int32The zero-based column ordinal.
dataOffset
Int64The index within the row from which to begin the read operation.
buffer
Byte[]The buffer into which to copy the data.
bufferOffset
Int32The index with the buffer to which the data will be copied.
length
Int32The 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 override char GetChar(int ordinal)
Parameters
ordinal
Int32The zero-based column ordinal.
Returns
- Char
The character value of the specified column.
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.
public override long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length)
Parameters
ordinal
Int32The zero-based column ordinal.
dataOffset
Int64The index within the row from which to begin the read operation.
buffer
Char[]The buffer into which to copy the data.
bufferOffset
Int32The index with the buffer to which the data will be copied.
length
Int32The maximum number of characters to read.
Returns
- Int64
The actual number of characters read.
GetDataTypeName(Int32)
Gets the name of the data type.
public override string GetDataTypeName(int ordinal)
Parameters
ordinal
Int32The zero-based column ordinal.
Returns
- String
System.String.
GetDateTime(Int32)
Gets the date and time data value of the specified field.
public override DateTime GetDateTime(int ordinal)
Parameters
ordinal
Int32The 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 override decimal GetDecimal(int ordinal)
Parameters
ordinal
Int32The 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 override double GetDouble(int ordinal)
Parameters
ordinal
Int32The index of the field to find.
Returns
- Double
The double-precision floating point number of the specified field.
GetEnumerator()
Returns an System.Collections.IEnumerator that can be used to iterate through the rows in the data reader.
public override IEnumerator GetEnumerator()
Returns
- IEnumerator
An System.Collections.IEnumerator that can be used to iterate through the rows in the data reader.
Exceptions
- 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(System.Int32).
public override Type GetFieldType(int ordinal)
Parameters
ordinal
Int32The 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 override float GetFloat(int ordinal)
Parameters
ordinal
Int32The 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 override Guid GetGuid(int ordinal)
Parameters
ordinal
Int32The 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 override short GetInt16(int ordinal)
Parameters
ordinal
Int32The 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 override int GetInt32(int ordinal)
Parameters
ordinal
Int32The 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 override long GetInt64(int ordinal)
Parameters
ordinal
Int32The 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 override string GetName(int ordinal)
Parameters
ordinal
Int32The 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 override int GetOrdinal(string name)
Parameters
name
StringThe 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 override string GetString(int ordinal)
Parameters
ordinal
Int32The 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 override object GetValue(int ordinal)
Parameters
ordinal
Int32The 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 override 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 override bool IsDBNull(int ordinal)
Parameters
ordinal
Int32The index of the field to find.
Returns
- Boolean
true if the specified field is set to null; otherwise, false.
NextResult()
Advances the reader to the next result when reading the results of a batch of statements.
public override bool NextResult()
Returns
- Boolean
true
if there are more result sets; otherwisefalse
.
Read()
Advances the System.Data.DbDataReader to the next record.
public override bool Read()
Returns
- Boolean
true
if there are more rows; otherwise,false
.
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.