Class EnumerableDataReader<T>
IBulkActionDataReader implementation for any list of objects.
Inheritance
Implements
Namespace: Kros.Data.BulkActions
Assembly: Kros.Utils.dll
Syntax
public class EnumerableDataReader<T> : IBulkActionDataReader, IDisposable
Type Parameters
Name | Description |
---|---|
T | Object data type. |
Remarks
Class implements IBulkActionDataReader for any list of objects, so this list can be easily used in bulk actions (IBulkInsert, IBulkUpdate).
Constructors
EnumerableDataReader(IEnumerable<T>, IEnumerable<String>)
Creates instance of reader over data
with list of columns columnNames
.
Declaration
public EnumerableDataReader(IEnumerable<T> data, IEnumerable<string> columnNames)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | data | Data which reader operates with. |
System.Collections.Generic.IEnumerable<System.String> | columnNames | List of columns with which reader works.
For every column must exists property with the same name in object |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Value of |
System.ArgumentException | List |
System.InvalidOperationException | Class |
Properties
FieldCount
Columns count.
Declaration
public int FieldCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
GetName(Int32)
Column name at index i
.
Declaration
public string GetName(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | Column index. |
Returns
Type | Description |
---|---|
System.String | Column name. |
GetOrdinal(String)
Index of column with name
.
Declaration
public int GetOrdinal(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Column name. |
Returns
Type | Description |
---|---|
System.Int32 | Index. |
GetValue(Int32)
Returns value of column at index i
.
Declaration
public object GetValue(int i)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | i | Column index. |
Returns
Type | Description |
---|---|
System.Object | Column value. |
Read()
Moves to next record.
Declaration
public bool Read()
Returns
Type | Description |
---|---|
System.Boolean | true if move was successfull, false if there is no next record. |