Class DataReaderExtensions
Inheritance
DataReaderExtensions
Assembly: Estrelica.Utility.dll
Syntax
[DoNotObfuscateType]
public static class DataReaderExtensions
Methods
Declaration
public static bool GetBool(this IDataReader rdr, int columnIndex, bool defaultIfNull)
Parameters
Returns
Declaration
public static bool GetBool(this IDataReader rdr, string columnName, bool defaultIfNull)
Parameters
Returns
Declaration
public static bool? GetBoolNullable(this IDataReader rdr, int columnIndex)
Parameters
Returns
Declaration
public static bool? GetBoolNullable(this IDataReader rdr, string columnName)
Parameters
Returns
Declaration
public static DateTime GetDateTime(this IDataReader rdr, int columnIndex, DateTime defaultIfNull, string dateTimeFormatIfString = null)
Parameters
Returns
Declaration
public static DateTime GetDateTime(this IDataReader rdr, string columnName, DateTime defaultIfNull, string dateTimeFormatIfString = null)
Parameters
Returns
Declaration
public static decimal GetDecimal(this IDataReader rdr, int columnIndex, decimal defaultIfNull)
Parameters
Returns
Declaration
public static decimal GetDecimal(this IDataReader rdr, string columnName, decimal defaultIfNull)
Parameters
Returns
Declaration
public static decimal? GetDecimalNullable(this IDataReader rdr, int columnIndex, decimal? defaultIfNull = null)
Parameters
Returns
Declaration
public static decimal? GetDecimalNullable(this IDataReader rdr, string columnName, decimal? defaultIfNull = null)
Parameters
Returns
Declaration
public static E? GetEnumNullable<E>(this IDataReader rdr, int columnIndex) where E : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static E? GetEnumNullable<E>(this IDataReader rdr, string columnName) where E : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static E GetEnum<E>(this IDataReader rdr, int columnIndex, E defaultIfNull) where E : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static E GetEnum<E>(this IDataReader rdr, string columnName, E defaultIfNull) where E : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static Guid GetGuid(this IDataReader rdr, int columnIndex, Guid defaultIfNull)
Parameters
Returns
Declaration
public static Guid GetGuid(this IDataReader rdr, string columnName, Guid defaultIfNull)
Parameters
Returns
Declaration
public static Guid? GetGuidNullable(this IDataReader rdr, int columnIndex)
Parameters
Returns
Declaration
public static Guid? GetGuidNullable(this IDataReader rdr, string columnName)
Parameters
Returns
Declaration
public static int GetInt(this IDataReader rdr, int columnIndex, int defaultIfNull = 0)
Parameters
Returns
Declaration
public static int GetInt(this IDataReader rdr, string columnName, int defaultIfNull = 0)
Parameters
Returns
Declaration
public static int? GetIntNullable(this IDataReader rdr, int columnIndex)
Parameters
Returns
Declaration
public static int? GetIntNullable(this IDataReader rdr, string columnName)
Parameters
Returns
Retrieves value from IDataReader column (by integer index) as a string
Declaration
public static string GetString(this IDataReader rdr, int columnIndex, bool returnNullIfEmpty = true)
Parameters
Returns
string
Returns ParseString() on the value in column at columnIndex from IDataReader rdr
|
Retrieves value from IDataReader column (by column name) as a string
Declaration
public static string GetString(this IDataReader rdr, string columnName, bool returnNullIfEmpty = true)
Parameters
Returns
string
Returns ParseString() on the value in column named columnName from IDataReader rdr
|
Declaration
public static string GetStringNullable(this IDataReader rdr, int columnIndex)
Parameters
Returns
Declaration
public static string GetStringNullable(this IDataReader rdr, string columnName)
Parameters
Returns
Retrieves value from IDataReader column (by integer index) as a string
Declaration
public static dynamic GetValue(this IDataReader rdr, int columnIndex)
Parameters
Returns
dynamic
Returns the value from column at index columnIndex from IDataReader rdr. DBNull.Value results are returned as null.
|
Retrieves value from IDataReader column (by column name)
Declaration
public static dynamic GetValue(this IDataReader rdr, string columnName)
Parameters
Returns
dynamic
Returns the value in column named columnName from IDataReader rdr. DBNull.Value results are returned as null.
|
Declaration
public static bool? ParseBool(object value, bool? defaultIfNull = null)
Parameters
Returns
Declaration
public static DateTime? ParseDateTime(object value, DateTime? defaultIfNull = null, string dateTimeFormatIfString = null)
Parameters
Returns
Declaration
public static decimal? ParseDecimal(object value, decimal? defaultIfNull = null)
Parameters
Returns
Declaration
public static E ParseEnum<E>(object value, E defaultIfNull = default) where E : struct, Enum
Parameters
Returns
Type Parameters
Declaration
public static Guid? ParseGuid(object value, Guid? defaultIfNull = null)
Parameters
Returns
Declaration
public static int? ParseInt(object value, int? defaultIfNull = null)
Parameters
Returns
Declaration
public static E? ParseNullableEnum<E>(object value, E? defaultIfNull = null) where E : struct, Enum
Parameters
Returns
Type Parameters
Returns null if value is null or DBNull.Value, otherwise value as a string if it is System.String or .ToString() on the object if not.
If returnNullIfEmpty == true, always returns null if the result is String.Empty.
Declaration
public static string ParseString(object value, bool returnNullIfEmpty = true)
Parameters
object
value
value to be returned as a string
|
bool
returnNullIfEmpty
True if String.Empty results should be returned as null
|
Returns
Returns null if value is null or DBNull.Value
Declaration
public static dynamic ParseValue(object value)
Parameters
Returns
Declaration
public static IEnumerable<Dictionary<string, dynamic>> ToDictionaries(this IDataReader rdr, Func<string, object, object> valueConverter = null)
Parameters
Returns
Declaration
public static Dictionary<string, dynamic> ToDictionary(this IDataReader rdr, Func<string, object, object> valueConverter, ref string[] columnNames, int startingIndex = 0, int endingIndex = 0)
Parameters
Returns