/// <summary> /// Executes this operation, sending the input of this operation /// to all its child operations /// </summary> /// <param name="rows">The rows.</param> /// <returns></returns> public override IEnumerable <Row> Execute(IEnumerable <Row> rows) { var copiedRows = new CachingEnumerable <Row>(rows); foreach (var operation in Operations) { var cloned = copiedRows.Select(r => r.Clone()); var enumerable = operation.Execute(cloned); if (enumerable == null) { continue; } var enumerator = enumerable.GetEnumerator(); #pragma warning disable 642 while (enumerator.MoveNext()) { ; } #pragma warning restore 642 } yield break; }
/// <summary> /// Executes this operation, sending the input of this operation /// to all its child operations /// </summary> /// <param name="rows">The rows.</param> /// <param name="cancellationToken">A CancellationToken to stop execution</param> /// <returns></returns> public override IAsyncEnumerable <Row> Execute(IAsyncEnumerable <Row> rows, CancellationToken cancellationToken = default) { return(new AsyncEnumerable <Row>(async yield => { var copiedRows = new CachingEnumerable <Row>(rows, cancellationToken); foreach (IOperation operation in Operations) { var cloned = copiedRows.Select(r => r.Clone()); IAsyncEnumerable <Row> enumerable = operation.Execute(cloned, cancellationToken); if (enumerable == null) { continue; } IAsyncEnumerator <Row> enumerator = enumerable.GetAsyncEnumerator(cancellationToken); #pragma warning disable 642 while (await enumerator.MoveNextAsync()) { ; } #pragma warning restore 642 } yield.Break(); })); }
/// <summary> /// Executes this operation, sending the input of this operation /// to all its child operations /// </summary> /// <param name="rows">The rows.</param> /// <returns></returns> public override IEnumerable<Row> Execute(IEnumerable<Row> rows) { var copiedRows = new CachingEnumerable<Row>(rows); foreach (var operation in Operations) { var cloned = copiedRows.Select(r => r.Clone()); var enumerable = operation.Execute(cloned); if (enumerable == null) continue; var enumerator = enumerable.GetEnumerator(); #pragma warning disable 642 while (enumerator.MoveNext()) ; #pragma warning restore 642 } yield break; }