public static void Remove(this Dictionary <string, Dictionary <string, SyncPartition> > dictionary,
                                  SyncPartition taskToSync)
        {
            dictionary[taskToSync.DbTable.Name].Remove(taskToSync.DbPartition.PartitionKey);

            if (dictionary[taskToSync.DbTable.Name].Count == 0)
            {
                dictionary.Remove(taskToSync.DbTable.Name);
            }
        }
        public void SynchronizePartition(DbTable dbTable, DbPartition partitionToSave, DataSynchronizationPeriod period)
        {
            lock (_lockObject)
            {
                if (CheckIfWeHaveSyncTableTaskEarlier(dbTable.Name, period))
                {
                    return;
                }

                if (!_syncPartitions.ContainsKey(dbTable.Name))
                {
                    _syncPartitions.Add(dbTable.Name, new Dictionary <string, SyncPartition>());
                }

                var dict = _syncPartitions[dbTable.Name];

                if (!dict.ContainsKey(partitionToSave.PartitionKey))
                {
                    dict.Add(partitionToSave.PartitionKey, SyncPartition.Create(dbTable, partitionToSave, period));
                }
            }
        }
Esempio n. 3
0
 public void SynchronizePartition(DbTable dbTable, string partitionKey, DataSynchronizationPeriod period)
 {
     EnqueueTask(dbTable, SyncPartition.Create(dbTable, partitionKey, period));
 }