Skip to content

Reader Class ​

Definition ​

Reader for a database result

  • Namespace: JASE.Database
  • Assembly: JASE.Database.dll

Properties ​

NameDescription
DepthGets a value indicating the depth of nesting for the current row
FieldCountReturns the number of columns in the current row
HasRowsReturns a value that indicates whether underlying Reader contains one or more rows
IsClosedReturns a value indicating whether the unerlying Reader is closed
ItemReturns the Reader value at index position
ItemReturns Reader value based on column name
QueryTimeReturns TimeSpan representing the elapsed time spent obtaining the Reader instance
RecordsAffectedReturns the number of rows changed, inserted, or deleted by execution of the SQL statement
VisibleFieldCountReturns the number of fields in the underlying Reader that are not hidden

Methods ​

NameDescription
bool Close()Closes the Reader
void Dispose()Bulk clean-up of objects needing Disposal occurs here
ValueTask DisposeAsync()Calls DisposeAsyncCore() and GC.SuppressFinalize
bool GetBoolean(int ordinal)Returns the value of the specified column as a Boolean
bool? GetBoolean(string name)Returns the value of the specified column name as a Boolean.
byte GetByte(int ordinal)Returns the value of the specified column as a Byte
byte? GetByte(string name)Returns the value of the specified column name as a Byte.
long GetBytes(int ordinal, long offset, byte[] buffer, int bufferOffset, int length)Reads a specified number of bytes from the specified column starting at a specified index and writes them to a buffer starting at a specified position in the buffer.
char GetChar(int ordinal)Reads the value of the specified column as a single character
long GetChars(int ordinal, long offset, char[] buffer, int bufferOffset, int length)reads a specified number of characters from a specified column starting at a specified index, and writes them to a buffer starting at a specified position
string GetDatatypeName(int ordinal)Returns name of the data type of the specified column
DateTime GetDateTime(int ordinal)Returns the value of the specified column as a DateTime
DateTime? GetDateTime(string name)Returns the value of the specified column name as a DateTime.
decimal GetDecimal(int ordinal)Returns the value of the specified column as a Decimal
decimal? GetDecimal(string name)Returns the value of the specified column name as a Decimal.
double GetDouble(int ordinal)Returns the value of the specified column as a Double
double? GetDouble(string name)Returns the value of the specified column name as a Double.
Type GetFieldType(int ordinal)Returns the data type of the specified column
T GetFieldValue(int ordinal)Gets the value of the specified column as the requested type
float GetFloat(int ordinal)Returns the value of the specified column as a Single
float? GetFloat(string name)Returns the value of the specified column name as a Single.
Guid GetGuid(int ordinal)Returns the value of the specified column as a Guid
Guid? GetGuid(string name)Returns the value of the specified column name as a Guid.
short GetInt16(int ordinal)Returns the value of the specified column as an Int16
short? GetInt16(string name)Returns the value of the specified column name as a Int16.
int GetInt32(int ordinal)Returns the value of the specified column as a Int32
int? GetInt32(string name)Returns the value of the specified column name as a Int32.
long GetInt64(int ordinal)Returns the value of the specified column as a Int64
long? GetInt64(string name)Returns the value of the specified column name as a Int64.
JsonDocument GetJsonDocument(int ordinal)Reads the value at the specified ordinal as a JsonDocument.
JsonElement GetJsonElement(int ordinal)Reads the value at the specified ordinal as a JsonElement.
string GetName(int ordinal)Returns the name of the column, given the zero-based column ordinal
JsonElement? GetNullableJsonElement(int ordinal)Reads the value at the specified ordinal as a nullable JsonElement.
int GetOrdinal(string name)Returns the column ordinal given the name of the column
DataTable GetSchemaTable()Returns a DataTable that describing the column metadata of the Reader
string GetString(int ordinal)Returns the value of the specified column index as a String
string GetString(string name)Returns the value of the specified column name as a String.
object GetValue(int ordinal)Returns the value of the specified column as an instance of Object
object GetValue(string name)Returns the value of the specified column name as a Object.
int GetValues(object[] values)Populates an array of objects with the column values of the current row
bool HasColumn(string name)Checks if column name is contained in the reader
bool IsDBNull(int ordinal)Returns a value that indicates whether the column contains nonexistent or missing values
bool IsDisposed()Returns if Reader object has been disposed
bool NextResult()Advances the reader to the next result when reading the results of a batch of statements
Task<bool> NextResultAsync()Asynchronously advances the reader to the next result when reading the results of a batch of statements
Task<bool> NextResultAsync(CancellationToken cancellationToken)Asynchronously advances the reader to the next result when reading the results of a batch of statements
bool Read()Advances the reader to the next record in a result set
Task<bool> ReadAsync()Asynchronously advances the reader to the next record in a result set
Task<bool> ReadAsync(CancellationToken cancellationToken)Asynchronously advances the reader to the next record in a result set
T SafeGet(int ordinal)Safe version of GetFieldValue that implements an IsDBNull check
T? SafeGetNullable(int ordinal)Safe version of GetFieldValue that implements an IsDBNull check
string SafeGetString(int ordinal)Safe version of GetString that implements an IsDBNull check
T ToClass(TableInfo tableInfo)Generates a Type class object from a reader row
Dictionary<string, object> ToDictionary(HashSet<string> ignoreColumns, bool includeNulls = null, bool closeReader = null)Returns reader entry/row as a Dictionary<string, object>
Dictionary<string, object> ToDictionary(IList<string> ignoreColumns = null, bool includeNulls = null, bool closeReader = null)Returns reader entry/row as a Dictionary<string, object>
List<Dictionary<string, object>> ToDictionaryList(IList<string> ignoreColumns = null, bool includeNulls = null, bool closeReader = null)Returns reader entry as a Dictionary<string, object>