public static long GetInt64(this DbDataRecord dr, string columnName) { Check.ArgNotNull(dr, nameof(dr)); int ordinal = dr.GetOrdinal(columnName); return(dr.GetInt64(ordinal)); }
public static bool GetBoolean(this DbDataRecord rec, string fieldName) { var index = rec.GetOrdinal(fieldName); var value = rec.GetValue(index); if (value is bool || value is Boolean) { return((bool)value); } else if (value is SByte || value is sbyte) { return((sbyte)value == 1); } else { return(rec.GetInt64(index) == 1); } }