Method ForEach
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
ForEach(IDataReader, Action<IDataRecord>, bool, CancellationToken)
Iterates all records from an IDataReader.
public static void ForEach(this IDataReader reader, Action<IDataRecord> handler, bool throwOnCancellation, CancellationToken cancellationToken = default)
Parameters
readerIDataReaderThe IDataReader to iterate.
handlerAction<IDataRecord>The handler function for each IDataRecord.
throwOnCancellationboolIf true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.
cancellationTokenCancellationTokenAn optional cancellation token for stopping the iteration.
ForEach(IDataReader, Action<IDataRecord>, CancellationToken)
Iterates all records from an IDataReader.
public static void ForEach(this IDataReader reader, Action<IDataRecord> handler, CancellationToken cancellationToken = default)
Parameters
readerIDataReaderThe IDataReader to iterate.
handlerAction<IDataRecord>The handler function for each IDataRecord.
cancellationTokenCancellationTokenAn optional cancellation token for stopping the iteration.