コード例 #1
0
        public void ForEach(int batchCount, int dellayInMilliSeconds, Func <List <IContactDetails>, bool>[] operations)
        {
            ResetMonitoringParameters();
            Tuple <List <ContactDetailsEntity>, TableContinuationToken> nextBatch =
                new Tuple <List <ContactDetailsEntity>, TableContinuationToken>(null, null);

            do
            {
                nextBatch = _elementSource.GetAllEntitiesByBatchs <ContactDetailsEntity>(batchCount, nextBatch.Item2);
                //nextBatch = new Tuple<List<ContactDetailsEntity>, TableContinuationToken>(_elementSource.Get<ContactDetailsEntity>("+972524645991") , null);
                List <IContactDetails> items = ModelConverter.GetContactDetailsList(nextBatch.Item1);
                foreach (var operation in operations)
                {
                    var result = operation.Invoke(items);
                    if (!result)
                    {
                        _logger.Write(new Log()
                        {
                            Details = operation.Method.Name,
                            Title   = "Operation Failed",
                        });
                    }
                }

                UpdateMonitor(nextBatch.Item1.Count, nextBatch.Item1.Last().PartitionKey);

                Thread.Sleep(dellayInMilliSeconds);
            } while (nextBatch.Item2 != null);
        }