コード例 #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);
        }
コード例 #2
0
        //todo: consider using IgnoreResourceNotFoundException

        public AzureTableStorage(string connectionString, IMyStateLogger logger)
        {
            try
            {
                _logger = logger;
                // Retrieve the storage account from the connection string.
                var storageAccount = CloudStorageAccount.Parse(connectionString);

                // Create the table client.
                _tableClient = storageAccount.CreateCloudTableClient();
                // Create the table if it doesn't exist.
                CreateTables();
            }
            catch (Exception ex)
            {
                _logger.Write(new Log(ex, "AzureTableStorage", Log.MessageType.Exception, "Constractor"));
            }
        }
コード例 #3
0
        private void CreateTables()
        {
            try
            {
                tableTypeDictionary = new Dictionary <string, string>(2);

                CreateTable <StateHistoryEntity>();
                CreateTable <MessageForClient>();
                CreateTable <LogRecord>();
                CreateTable <SyncContactsRawData>();
                CreateTable <ContactDetailsEntity>();
                CreateTable <ContactDetailsEntity>(ContactDetailsEntity.SuspectedNamesVault);
                CreateTable <ContactDetailsEntity>(ContactDetailsEntity.DuplicateBackup);
                CreateTable <CallDetailsEntity>();
            }
            catch (Exception ex)
            {
                _logger.Write(new Log(ex, "AzureTableStorage", Log.MessageType.Exception, "CreateTables"));
            }
        }