Пример #1
0
        private async Task TransferAvailableData(TaskDispatcher taskDispatcher, SourceDataPipeline sourceDataPipeline)
        {
            DataTable availableDataTable;

            while (sourceDataPipeline.TryGetNextAvailableDataSource(out availableDataTable))
            {
                DataTable availableDataTable2 = availableDataTable;

                // Dispatch the work of transferring data from the "source pipeline" int the database to an available background thread.
                // Note: The await awaits only until the work is dispatched and not until the work is completed.
                //       Dispatching the work itself may take a while if all available background threads are busy.
                await taskDispatcher.DispatchWorkAsync(() => this.TransferTable(availableDataTable2));
            }
        }
        private async Task TransferAvailableData(TaskDispatcher taskDispatcher, SourceDataPipeline sourceDataPipeline)
        {
            DataTable availableDataTable;
            while (sourceDataPipeline.TryGetNextAvailableDataSource(out availableDataTable))
            {
                DataTable availableDataTable2 = availableDataTable;

                // Dispatch the work of transferring data from the "source pipeline" int the database to an available background thread.
                // Note: The await awaits only until the work is dispatched and not until the work is completed. 
                //       Dispatching the work itself may take a while if all available background threads are busy. 
                await taskDispatcher.DispatchWorkAsync(() => this.TransferTable(availableDataTable2));
            }
        }