public virtual bool GetBool(string colName)
 {
     if (ContainedReader.IsDBNull(GetOrdinal(colName)))
     {
         return(false);
     }
     return(bool.Parse(ContainedReader[colName].ToString()));
 }
        public virtual T GetValue <T>(string colName, T defaultValue)
        {
            if (ContainedReader.IsDBNull(GetOrdinal(colName)))
            {
                return(defaultValue);
            }
            Type t = typeof(T);

            if (t == typeof(string))
            {
                return((T)Convert.ChangeType((string)ContainedReader[colName], t));
            }
            t = Nullable.GetUnderlyingType(t) ?? t;

            if (t.IsEnum)
            {
                return((T)Enum.Parse(t, (string)ContainedReader[colName]));
            }
            else
            {
                return((T)Convert.ChangeType(ContainedReader[colName], t));
            }
        }
 public virtual byte[] GetByteArray(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column))
                ? null
                : ((byte[])ContainedReader[column]));
 }
 public virtual byte GetByte(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column))
                ? (byte)0
                : ((IConvertible)ContainedReader[column]).ToByte(null));
 }
 public bool IsDBNull(string colName)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(colName)));
 }
 public char GetChar(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column)) ? char.MinValue : ContainedReader[column].ToString()[0]);
 }
 public virtual DateTime GetDateTime(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column)) ? DateTime.MinValue : DateTime.Parse(ContainedReader[column].ToString()));
 }
 public decimal GetDecimal(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column))
                ? 0
                : decimal.Parse(ContainedReader[column].ToString()));
 }
 public virtual double GetDouble(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column))
                ? 0
                : double.Parse(ContainedReader[column].ToString()));
 }
Esempio n. 10
0
 public float GetFloat(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column)) ? 0 : float.Parse(ContainedReader[column].ToString()));
 }
Esempio n. 11
0
 public virtual short GetInt16(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column)) ? (short)0 : short.Parse(ContainedReader[column].ToString()));
 }
Esempio n. 12
0
 public virtual int GetInt32(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column))
                ? 0
                : ((IConvertible)ContainedReader[column]).ToInt32(null));
 }
Esempio n. 13
0
 public virtual Guid GetGuid(string column)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(column)) ? Guid.Empty : (Guid)ContainedReader[column]);
 }
Esempio n. 14
0
 public virtual string GetString(int index)
 {
     return(ContainedReader.IsDBNull(index) ? null : ContainedReader[index].ToString().Trim());
 }
Esempio n. 15
0
 public virtual string GetString(string colName)
 {
     return(ContainedReader.IsDBNull(GetOrdinal(colName)) ? null : ContainedReader[colName].ToString().Trim());
 }