Table of Contents

Class DataRecordExtensions

Namespace
FluentCommand.Extensions
Assembly
FluentCommand.dll

Extension methods for IDataRecord.

public static class DataRecordExtensions
Inheritance
DataRecordExtensions
Inherited Members

Methods

GetBoolean(IDataRecord, string)

Gets the value of the specified column as a bool.

public static bool GetBoolean(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

bool

The value of the column.

Remarks

Returns false for null.

GetBooleanNull(IDataRecord, string)

Gets the value of the specified column as a bool.

public static bool? GetBooleanNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

bool?

The value of the column.

Remarks

Returns false for null.

GetByte(IDataRecord, string)

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

public static byte GetByte(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

byte

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

Remarks

Returns 0 for null.

GetByteNull(IDataRecord, string)

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

public static byte? GetByteNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

byte?

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

Remarks

Returns 0 for null.

GetBytes(IDataRecord, int)

Gets a stream of bytes from the specified column.

public static byte[] GetBytes(this IDataRecord dataRecord, int index)

Parameters

dataRecord IDataRecord

The data record.

index int

The zero-based column ordinal.

Returns

byte[]

A stream of bytes of the specified column.

GetBytes(IDataRecord, string)

Gets a stream of bytes from the specified column.

public static byte[] GetBytes(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

byte[]

A stream of bytes of the specified column.

Remarks

Returns empty array for null.

GetBytes(IDataRecord, string, long, byte[], int, int)

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

public static long GetBytes(this IDataRecord dataRecord, string name, long fieldOffset, byte[] buffer, int bufferOffset, int length)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

fieldOffset long

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

buffer byte[]

The buffer into which to read the stream of bytes.

bufferOffset int

The index for buffer to start the read operation.

length int

The number of bytes to read.

Returns

long

The actual number of bytes read.

Remarks

Returns 0 for null.

GetChar(IDataRecord, string)

Gets the character value of the specified column.

public static char GetChar(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

char

The character value of the specified column.

Remarks

Returns Char.MinValue for null.

GetCharNull(IDataRecord, string)

Gets the character value of the specified column.

public static char? GetCharNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

char?

The character value of the specified column.

Remarks

Returns Char.MinValue for null.

GetChars(IDataRecord, string, long, char[], int, int)

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

public static long GetChars(this IDataRecord dataRecord, string name, long fieldOffset, char[] buffer, int bufferOffset, int length)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

fieldOffset long

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

buffer char[]

The buffer into which to read the stream of bytes.

bufferOffset int

The index for buffer to start the read operation.

length int

The number of bytes to read.

Returns

long

The actual number of characters read.

Remarks

Returns 0 for null.

GetData(IDataRecord, string)

Returns an IDataReader for the specified column name.

public static IDataReader GetData(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

IDataReader

The IDataReader for the specified column name.

GetDataTypeName(IDataRecord, string)

Gets the data type information for the specified field.

public static string GetDataTypeName(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

string

The data type information for the specified field.

GetDateOnly(IDataRecord, string)

Gets the DateOnly value of the specified field.

public static DateOnly GetDateOnly(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateOnly

The DateOnly value of the specified field.

GetDateOnlyNull(IDataRecord, string)

Gets the DateOnly value of the specified field.

public static DateOnly? GetDateOnlyNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateOnly?

The DateOnly value of the specified field.

GetDateTime(IDataRecord, string)

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

public static DateTime GetDateTime(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateTime

The date and time data value of the specified field.

Remarks

Returns DateTime.MinValue for null.

GetDateTimeNull(IDataRecord, string)

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

public static DateTime? GetDateTimeNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateTime?

The date and time data value of the specified field.

Remarks

Returns DateTime.MinValue for null.

GetDateTimeOffset(IDataRecord, int)

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

public static DateTimeOffset GetDateTimeOffset(this IDataRecord dataRecord, int index)

Parameters

dataRecord IDataRecord

The data record.

index int

The zero-based column ordinal.

Returns

DateTimeOffset

The date and time data value of the specified field.

GetDateTimeOffset(IDataRecord, string)

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

public static DateTimeOffset GetDateTimeOffset(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateTimeOffset

The date and time data value of the specified field.

Remarks

Returns DateTime.MinValue for null.

GetDateTimeOffsetNull(IDataRecord, string)

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

public static DateTimeOffset? GetDateTimeOffsetNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

DateTimeOffset?

The date and time data value of the specified field.

Remarks

Returns DateTime.MinValue for null.

GetDecimal(IDataRecord, string)

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

public static decimal GetDecimal(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

decimal

The fixed-position numeric value of the specified field.

Remarks

Returns 0 for null.

GetDecimalNull(IDataRecord, string)

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

public static decimal? GetDecimalNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

decimal?

The fixed-position numeric value of the specified field.

Remarks

Returns 0 for null.

GetDouble(IDataRecord, string)

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

public static double GetDouble(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

double

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

Remarks

Returns 0 for null.

GetDoubleNull(IDataRecord, string)

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

public static double? GetDoubleNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

double?

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

Remarks

Returns 0 for null.

GetFieldType(IDataRecord, string)

Gets the Type information corresponding to the type of object that would be returned from GetValue(IDataRecord, string).

public static Type GetFieldType(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

Type

The Type information corresponding to the type of object that would be returned from GetValue(IDataRecord, string).

GetFloat(IDataRecord, string)

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

public static float GetFloat(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

float

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

Remarks

Returns 0 for null.

GetFloatNull(IDataRecord, string)

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

public static float? GetFloatNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

float?

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

Remarks

Returns 0 for null.

GetGuid(IDataRecord, string)

Gets the Guid value of the specified field..

public static Guid GetGuid(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

Guid

The Guid value of the specified field.

Remarks

Returns Guid.Empty for null.

GetGuidNull(IDataRecord, string)

Gets the Guid value of the specified field..

public static Guid? GetGuidNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

Guid?

The Guid value of the specified field.

Remarks

Returns Guid.Empty for null.

GetInt16(IDataRecord, string)

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

public static short GetInt16(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

short

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

Remarks

Returns 0 for null.

GetInt16Null(IDataRecord, string)

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

public static short? GetInt16Null(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

short?

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

Remarks

Returns 0 for null.

GetInt32(IDataRecord, string)

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

public static int GetInt32(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

int

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

Remarks

Returns 0 for null.

GetInt32Null(IDataRecord, string)

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

public static int? GetInt32Null(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

int?

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

Remarks

Returns 0 for null.

GetInt64(IDataRecord, string)

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

public static long GetInt64(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

long

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

Remarks

Returns 0 for null.

GetInt64Null(IDataRecord, string)

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

public static long? GetInt64Null(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

long?

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

Remarks

Returns 0 for null.

GetString(IDataRecord, string)

Gets the string value of the specified field.

public static string GetString(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

string

The string value of the specified field.

Remarks

Returns String.Empty for null.

GetStringNull(IDataRecord, string)

Gets the string value of the specified field.

public static string GetStringNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

string

The string value of the specified field.

GetTimeOnly(IDataRecord, string)

Gets the TimeOnly value of the specified field.

public static TimeOnly GetTimeOnly(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

TimeOnly

The TimeOnly value of the specified field.

GetTimeOnlyNull(IDataRecord, string)

Gets the TimeOnly value of the specified field.

public static TimeOnly? GetTimeOnlyNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

TimeOnly?

The TimeOnly value of the specified field.

GetValue(IDataRecord, string)

Gets the value of the specified field.

public static object GetValue(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

object

The object which will contain the field value upon return.

GetValue<T>(IDataRecord, int)

Gets the value of the specified field.

public static T GetValue<T>(this IDataRecord dataRecord, int index)

Parameters

dataRecord IDataRecord

The data record.

index int

The zero-based column ordinal.

Returns

T

The T which will contain the field value upon return.

Type Parameters

T

The record value type

GetValue<T>(IDataRecord, string)

Gets the value of the specified field.

public static T GetValue<T>(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

T

The T which will contain the field value upon return.

Type Parameters

T

The record value type

IsDBNull(IDataRecord, string)

Determines whether the specified field is set to null.

public static bool IsDBNull(this IDataRecord dataRecord, string name)

Parameters

dataRecord IDataRecord

The data record.

name string

The name of the field to find.

Returns

bool

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