public override void Map(Type targeWorkItemType, IEnumerable <KeyValuePair <IWorkItem, IIdentifiable> > workItemMappings, IWorkItemMapper workItemMapper)
        {
            var workingSet    = workItemMappings.ToList();
            var parentIdField = targeWorkItemType.GetProperty("ParentId");

            if (!workingSet.Any() || parentIdField == null)
            {
                return;
            }

            var workItems          = workingSet.Select(wi => wi.Key).ToList();
            var ids                = workItems.Select(wi => wi.Id);
            var asOf               = workItems.Max(wi => wi.ChangedDate);
            var childToParentLinks =
                _workItemStore.QueryLinks(string.Format(ParentLinkQueryFormat, string.Join(",", ids), asOf))
                .Where(link => link.LinkTypeId != SelfReferenceLinkId);
            var childToParentDictionary = childToParentLinks.ToDictionary(link => link.SourceId, link => link.TargetId);

            foreach (var workItemMapping in workingSet)
            {
                var childId = workItemMapping.Key.Id;
                if (childToParentDictionary.ContainsKey(childId))
                {
                    parentIdField.SetValue(workItemMapping.Value, childToParentDictionary[childId]);
                }
            }
        }
 public IEnumerable <IWorkItemLinkInfo> QueryLinks(string wiql, bool dayPrecision = false)
 {
     QueryLinksCallCount += 1;
     return(_innerWorkItemStore.QueryLinks(wiql, dayPrecision));
 }