public T Convert(DbDataReader reader)
        {
            if (_mappings == null || reader != _lastReader)
            {
                _mappings = MapProperties(reader);
            }

            var o = new T();

            foreach (var mapping in _mappings)
            {
                var prop     = mapping.Property;
                var rawValue = reader.GetValue(mapping.Index);
                var value    = DbConvert.To(prop.PropertyType, rawValue);
                prop.SetValue(o, value, null);
            }

            _lastReader = reader;

            return(o);
        }
 public static T Get <T>(this DbDataReader reader, string name)
 {
     return(DbConvert.To <T>(reader[name], CultureInfo.CurrentCulture));
 }
 public static T Get <T>(this DbDataReader reader, int ordinal)
 {
     return(DbConvert.To <T>(reader[ordinal], CultureInfo.CurrentCulture));
 }
 public static T Get <T>(this DbDataReader reader, string name, IFormatProvider provider)
 {
     return(DbConvert.To <T>(reader[name], provider));
 }
 public static T Get <T>(this DbDataReader reader, int ordinal, IFormatProvider provider)
 {
     return(DbConvert.To <T>(reader[ordinal], provider));
 }