Table of Contents

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

reader IDataReader

The IDataReader to iterate.

handler Action<IDataRecord>

The handler function for each IDataRecord.

throwOnCancellation bool

If true, when canceled, may exit the iteration via an exception. Otherwise when canceled will simply stop iterating and return without exception.

cancellationToken CancellationToken

An 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

reader IDataReader

The IDataReader to iterate.

handler Action<IDataRecord>

The handler function for each IDataRecord.

cancellationToken CancellationToken

An optional cancellation token for stopping the iteration.