/// <summary> /// Add a decorator to the enumerable for additional processing /// </summary> /// <param name="operation">The operation.</param> /// <param name="enumerator">The enumerator.</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> that may be used to cancel the asynchronous iteration.</param> protected override AsyncEnumerableTask <Row> DecorateEnumerableForExecution( IOperation operation, IAsyncEnumerable <Row> enumerator, CancellationToken cancellationToken = default) { return(AsyncEnumerableTask <Row> .Completed(new CachingEnumerable <Row>(new EventRaisingEnumerator(operation, enumerator), cancellationToken))); }
/// <summary> /// Add a decorator to the enumerable for additional processing /// </summary> /// <param name="operation">The operation.</param> /// <param name="enumerator">The enumerator.</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> that may be used to cancel the asynchronous iteration.</param> protected override AsyncEnumerableTask <Row> DecorateEnumerableForExecution(IOperation operation, IAsyncEnumerable <Row> enumerator, CancellationToken cancellationToken = default) { return(AsyncEnumerableTask <Row> .Completed(new AsyncEnumerable <Row>(async yield => { await new EventRaisingEnumerator(operation, enumerator) .ForEachAsync(async row => { await yield.ReturnAsync(row); }, cancellationToken); }))); }