예제 #1
0
        /// <summary>
        /// Ensure that whatever column we're currently processing is implicitly closed;
        /// </summary>
        private void CloseNestedObjectImplicitly()
        {
            // it would be nice to use Interlocked.Exchange to avoid multi-thread `race condition risk
            // when the the bridge is being misused by the user accessing it with multiple threads.
            // but this is called frequently enough to have a performance impact
            BridgeDataRecord currentNestedRecord = _currentNestedRecord;

            if (null != currentNestedRecord)
            {
                _currentNestedRecord = null;
                currentNestedRecord.CloseImplicitly();
            }
            BridgeDataReader currentNestedReader = _currentNestedReader;

            if (null != currentNestedReader)
            {
                _currentNestedReader = null;
                currentNestedReader.CloseImplicitly();
            }
        }
 /// <summary>
 /// Implicitly close this (nested) data reader; will be called whenever
 /// the user has done a GetValue() or a Read() on a parent reader/record
 /// to ensure that we consume all our results.  We do that because we
 /// our design requires us to be positioned at the next nested reader's
 /// first row.
 /// </summary>
 internal void CloseImplicitly()
 {
     Consume();
     DataRecord.CloseImplicitly();
 }