Azavea.Open.DAO.CSV.CsvDaLayer.DoneWithReader C# (CSharp) Méthode

DoneWithReader() protected méthode

Returns the reader for closing (or not, if we were configured with it).
protected DoneWithReader ( StreamReader reader ) : void
reader System.IO.StreamReader The StreamReader obtained from a GetReader call.
Résultat void
        protected internal void DoneWithReader(StreamReader reader)
        {
            // Close it unless we were configured with it.
            if (_connDesc.Type != CsvConnectionType.Reader)
            {
                reader.Close();
            }
        }

Usage Example

Exemple #1
0
 /// <summary>
 /// Create the data reader.
 /// </summary>
 /// <param name="layer">Data access layer that will give us the TextReader we need.</param>
 /// <param name="mapping">ClassMapping for the type we're returning.</param>
 /// <param name="criteria">Since there is no way to filter before we read the file,
 ///                     the reader checks each row read to see if it matches the
 ///                     criteria, if not, it is skipped.</param>
 public CsvDataReader(CsvDaLayer layer, ClassMapping mapping, DaoCriteria criteria)
     : base(layer, mapping, criteria, GetConfig(layer, mapping))
 {
     _reader = ((CsvDataReaderConfig) _config).Reader;
     try
     {
         PreProcessSorts();
     }
     catch (Exception e)
     {
         // Close the reader on error, since if the constructor throws
         // it isn't very reasonable to expect anyone else to call Close.
         if (_reader != null)
         {
             layer.DoneWithReader(_reader);
         }
         throw new LoggingException("Unable to read from CSV file and process sorts.", e);
     }
 }
All Usage Examples Of Azavea.Open.DAO.CSV.CsvDaLayer::DoneWithReader