Пример #1
0
 /// <summary>
 /// Reads all of the contents into memory because another <see cref="DbDataReader"/>
 /// needs to be opened.
 /// </summary>
 /// <remarks>
 /// This will result in a no op if the reader is closed or is already in memory.
 /// </remarks>
 public void ReadIntoMemory()
 {
     if (_reader.IsClosed == false && _reader.GetType() != typeof(NDataReader))
     {
         if (log.IsDebugEnabled)
         {
             log.Debug("Moving DbDataReader into an NDataReader.  It was converted in midstream " + _isMidstream.ToString());
         }
         _reader = NDataReader.Create(_reader, _isMidstream);
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the NHybridDataReader class.
        /// </summary>
        /// <param name="reader">The underlying DbDataReader to use.</param>
        /// <param name="inMemory"><see langword="true" /> if the contents of the DbDataReader should be read into memory right away.</param>
        public static NHybridDataReader Create(DbDataReader reader, bool inMemory)
        {
            var dataReader = new NHybridDataReader();

            if (inMemory)
            {
                dataReader._reader = NDataReader.Create(reader, false);
            }
            else
            {
                dataReader._reader = reader;
            }
            return(dataReader);
        }