public static T GetValue <T>(this SqlDataReaderLRAP me, string columnName, T defaultIfNull)
        {
            if (!me.HasRows)
            {
                return(defaultIfNull);
            }

            return(me[columnName] == DBNull.Value ? defaultIfNull : (T)me[columnName]);
        }
        public static T GetEnum <T>(this SqlDataReaderLRAP me, object defaultValue, string columnName) where T : struct, IConvertible
        {
            int value = Convert.ToInt32(me[columnName]);

            if (!Enum.IsDefined(typeof(T), value))
            {
                return((T)defaultValue);
            }

            return((T)(object)value);
        }
        public static T GetEnum <T>(this SqlDataReaderLRAP me, object defaultValue, int no) where T : struct, IConvertible
        {
            int value = me.GetInt32(no);

            if (!Enum.IsDefined(typeof(T), value))
            {
                return((T)defaultValue);
            }

            return((T)(object)value);
        }
        public static T ReadValue <T>(this SqlDataReaderLRAP reader, int ordinal, T defaultValueIfNull)
        {
            object value = reader[ordinal];

            if (!(value is DBNull))
            {
                return((T)value);
            }
            else
            {
                return(defaultValueIfNull);
            }
        }
        public static T ReadValue <T>(this SqlDataReaderLRAP reader, string columnName, T defaultValueIfNull)
        {
            object value = reader[columnName];

            if (!(value is DBNull))
            {
                return((T)value);
            }
            else
            {
                return(defaultValueIfNull);
            }
        }
 public static string GetInt32SafeToString(this SqlDataReaderLRAP me, int no, string defaultIfNull = "")
 {
     return(me.IsDBNull(no) ? defaultIfNull : me.GetInt32(no).ToString());
 }
 public static string ReadXml(this SqlDataReaderLRAP reader, string columnName, string defaultValueIfNull = "")
 {
     return(ReadValue <string>(reader, columnName, defaultValueIfNull));
 }
 public static DateTime GetDateTimeSafeToDateTime(this SqlDataReaderLRAP me, int no)
 {
     return(me.IsDBNull(no) ? DateTime.MinValue : me.GetDateTime(no));
 }
 public static string GetDateTimeSafeToString(this SqlDataReaderLRAP me, int no, string defaultIfNull = "")
 {
     return(me.IsDBNull(no) ? defaultIfNull : me.GetDateTime(no).ToLongDateString() + " : " + me.GetDateTime(no).ToLongTimeString());
 }
 public static int?GetInt32Nullable(this SqlDataReaderLRAP me, int no)
 {
     return(me.IsDBNull(no) ? (int?)null : (int?)me.GetInt32(no));
 }
 public static int ReadInt(this SqlDataReaderLRAP reader, string columnName, int defaultValueIfNull = -1)
 {
     return(ReadValue <int>(reader, columnName, defaultValueIfNull));
 }
 public static short ReadShort(this SqlDataReaderLRAP reader, string columnName, short defaultValueIfNull = -1)
 {
     return(ReadValue <short>(reader, columnName, defaultValueIfNull));
 }
 public static byte ReadByte(this SqlDataReaderLRAP reader, string columnName, byte defaultValueIfNull = 0)
 {
     return(ReadValue(reader, columnName, defaultValueIfNull));
 }
 public static T ReadValue <T>(this SqlDataReaderLRAP reader, int ordinal)
 {
     return(ReadValue <T>(reader, ordinal, default(T)));
 }
 public static T ReadValue <T>(this SqlDataReaderLRAP reader, string columnName)
 {
     return(ReadValue <T>(reader, columnName, default(T)));
 }
 public static int GetInt32SafeToInt(this SqlDataReaderLRAP me, int no, int defaultIfNull = -1)
 {
     return(me.IsDBNull(no) ? defaultIfNull : me.GetInt32(no));
 }
 public static Decimal GetDecimal(this SqlDataReaderLRAP me, int no, Decimal defaultIfNull = -1)
 {
     return(me.IsDBNull(no) ? defaultIfNull : me.GetDecimal(no));
 }
 public static byte[] ReadImage(this SqlDataReaderLRAP reader, string columnName, byte[] defaultValueIfNull = null)
 {
     return(ReadValue <byte[]>(reader, columnName, defaultValueIfNull));
 }
 public static DateTime?GetDateTimeNullable(this SqlDataReaderLRAP me, int no)
 {
     return(me.IsDBNull(no) ? (DateTime?)null : (DateTime?)me.GetDateTime(no));
 }
 public static long ReadLong(this SqlDataReaderLRAP reader, string columnName, long defaultValueIfNull = -1)
 {
     return(ReadValue <long>(reader, columnName, defaultValueIfNull));
 }
 public static decimal ReadDecimal(this SqlDataReaderLRAP reader, string columnName, decimal defaultValueIfNull = -1)
 {
     return(ReadValue <decimal>(reader, columnName, defaultValueIfNull));
 }
 public static bool ReadBoolean(this SqlDataReaderLRAP reader, string columnName, bool defaultValueIfNull = false)
 {
     return(ReadValue <bool>(reader, columnName, defaultValueIfNull));
 }
 public static string GetDateTimeSafeToString(this SqlDataReaderLRAP me, int no)
 {
     return(me.IsDBNull(no) ? DateTime.MinValue.ToString() : me.GetDateTime(no).ToString());
 }
 public static DateTime ReadDateTime(this SqlDataReaderLRAP reader, string columnName)
 {
     return(ReadValue <DateTime>(reader, columnName, DateTime.MinValue));
 }
 public static T GetValue <T>(this SqlDataReaderLRAP me, string columnName)
 {
     return(me[columnName] == DBNull.Value ? default(T) : (T)me[columnName]);
 }
 public static DateTime ReadDateTime(this SqlDataReaderLRAP reader, string columnName, DateTime defaultValueIfNull)
 {
     return(ReadValue <DateTime>(reader, columnName, defaultValueIfNull));
 }
 public static T GetValue <T>(this SqlDataReaderLRAP me, int columnNumber, T defaultIfNull)
 {
     return(me.IsDBNull(columnNumber) ? defaultIfNull : (T)me[columnNumber]);
 }
 public static int?ReadIntNullable(this SqlDataReaderLRAP reader, string columnName, int?defaultValueIfNull = null)
 {
     return(ReadValue <int?>(reader, columnName, defaultValueIfNull));
 }