コード例 #1
0
        private void DoParallelProcessing(StagingTablesBuilder b)
        {
            var pOptions = new ParallelOptions {
                MaxDegreeOfParallelism = _maxDegreeOfParallelism
            };

            Parallel.ForEach(b.GetTables(), pOptions, (table, loopState) =>
            {
                if (!loopState.IsExceptional)
                {
                    int issuesFound = Check(table);
                    if (issuesFound > 0)
                    {
                        loopState.Stop();
                        throw new ApplicationException($"Found {issuesFound} faulty rows in {table.Name}");
                    }
                }
            });
        }