public T ReadSingle(DbDataReader reader, ObjectsChangeTracker changeTracker)
        {
            T result = reader.Read() ? MapUsingState(reader, reader) : default(T);

            if (changeTracker != null)
            {
                changeTracker.RegisterObject(result);
            }
            return(result);
        }
Example #2
0
        public static T ToObject <T>(this DbDataReader reader, string readerName, string[] excludeFields,
                                     ObjectsChangeTracker changeTracker)
        {
            T result = new DataReaderToObjectMapper <T>(readerName, null, excludeFields).MapUsingState(reader, reader);

            if (changeTracker != null)
            {
                changeTracker.RegisterObject(result);
            }
            return(result);
        }
 public IEnumerable <T> ReadCollection(DbDataReader reader, ObjectsChangeTracker changeTracker)
 {
     while (reader.Read())
     {
         T result = MapUsingState(reader, reader);
         if (changeTracker != null)
         {
             changeTracker.RegisterObject(result);
         }
         yield return(result);
     }
     reader.Close();
 }