Beispiel #1
0
        public T Fill <T>()
        {
            var t    = PrimitiveTypeFiller.GetFillMethod <T>();
            var type = typeof(T);

            if (type.IsPrimitive || PrimitiveTypeFiller.TypesToTreatAsPrimitives.Contains(type))
            {
                return(PrimitiveTypeFiller.GetReaderValue <T>(reader, index: 0));
            }
            else if (type.IsNullable() &&
                     !IdTypeExtension.IsNullableIdType <T>() &&
                     !LongIdTypeExtension.IsNullableLongIdType <T>())
            {
                if (reader.IsDBNull(0))
                {
                    return(default(T));
                }

                return(PrimitiveTypeFiller.GetReaderValue <T>(reader, index: 0));
            }
            else if (type == typeof(object))
            {
                return((T)reader.GetValue(0));
            }
            else
            {
                var filler = objectFillerFactory.GetObjectFiller();
                T   entity = (T)filler.Build(type, reader);
                return(entity);
            }
        }
Beispiel #2
0
        public Binary GetBinary()
        {
            if (!Db.Settings.AllowLoadingBinaryData)
            {
                throw new Exception("Loading binary data is forbidden by default and has to be allowed explicitly");
            }

            return(PrimitiveTypeFiller.GetBinary(reader, index++));
        }
Beispiel #3
0
 public bool GetBoolean()
 {
     return(PrimitiveTypeFiller.GetBoolean(reader, index++));
 }
Beispiel #4
0
 public DateTimeOffset GetDateTimeOffset()
 {
     return(PrimitiveTypeFiller.GetDateTimeOffset(reader, index++));
 }
Beispiel #5
0
 public decimal?GetNullableMoney()
 {
     return(PrimitiveTypeFiller.GetNullableMoney(reader, index++));
 }
Beispiel #6
0
 public decimal GetMoney()
 {
     return(PrimitiveTypeFiller.GetMoney(reader, index++));
 }
Beispiel #7
0
 public double GetDouble()
 {
     return(PrimitiveTypeFiller.GetDouble(reader, index++));
 }
Beispiel #8
0
 public int?GetNullableInt32()
 {
     return(PrimitiveTypeFiller.GetNullableInt32(reader, index++));
 }
Beispiel #9
0
 public TimeSpan GetTimeSpan()
 {
     return(PrimitiveTypeFiller.GetTimeSpan(reader, index++));
 }
Beispiel #10
0
 public Binary GetRowVersion()
 {
     return(PrimitiveTypeFiller.GetBinary(reader, index++));
 }
Beispiel #11
0
 public T GetValue <T>()
 {
     return(PrimitiveTypeFiller.GetValue <T>(reader, index++));
 }
Beispiel #12
0
 public char?GetNullableChar()
 {
     return(PrimitiveTypeFiller.GetNullableChar(reader, index++));
 }
Beispiel #13
0
 public char GetChar()
 {
     return(PrimitiveTypeFiller.GetChar(reader, index++));
 }
Beispiel #14
0
 public byte GetByte()
 {
     return(PrimitiveTypeFiller.GetByte(reader, index++));
 }
Beispiel #15
0
 public int GetInt32()
 {
     return(PrimitiveTypeFiller.GetInt32(reader, index++));
 }
Beispiel #16
0
 public DateTime GetDateTime()
 {
     return(PrimitiveTypeFiller.GetDateTime(reader, index++));
 }
Beispiel #17
0
 public Date?GetNullableDate()
 {
     return(PrimitiveTypeFiller.GetNullableDate(reader, index++));
 }