コード例 #1
0
 private void EnqueueDependencies(MigrationItem completedItem, ConcurrentQueue <MigrationItem> queue, TextWriter log)
 {
     lock (syncRoot)
     {
         // mark item as processed
         itemsInProgress.Remove(completedItem.ObjectId);
         // and check all child items dependencies
         foreach (var childItem in GetChildDependencies(completedItem).Where(HasNoDependencies))
         {
             log.WriteLine($"Add {childItem} into a queue.");
             queue.Enqueue(childItem);
         }
     }
 }
コード例 #2
0
 private IEnumerable <MigrationItem> GetChildDependencies(MigrationItem item)
 {
     MigrationItem[] childs;
     return(dependenciesChild.TryGetValue(item.ObjectId, out childs) ? childs : Enumerable.Empty <MigrationItem>());
 }
コード例 #3
0
 private bool HasNoDependencies(MigrationItem item)
 {
     int[] parents;
     return(!dependenciesParent.TryGetValue(item.ObjectId, out parents) || parents.All(id => !itemsInProgress.Contains(id)));
 }