Пример #1
0
 protected RelativesExpression(Type type, Type ancestorType, Type descendentType, RelativesQueryDirection direction)
 {
     _type          = type;
     AncestorType   = ancestorType;
     DescendentType = descendentType;
     Direction      = direction;
 }
        private string GetQueryStringForRelativesOf(IEnumerable <int> ids, Type ancestorType, Type descendentType, RelativesQueryDirection direction, DateTime asOf)
        {
            var quotedDescendentIds = string.Join(", ", ids.Select(id => "'" + id + "'"));
            var queryString         = Constants.WORK_HIERARCHY_QUERY
                                      .Replace("#{{Ids}}", quotedDescendentIds)
                                      .Replace("#{{AncestorType}}", GetWorkItemType(ancestorType))
                                      .Replace("#{{DescendentType}}", GetWorkItemType(descendentType))
                                      .Replace("#{{Direction}}", direction == RelativesQueryDirection.AncestorFromDescendent ? "Target" : "Source")
                                      .Replace("#{{AsOf}}", asOf.ToUniversalTime().ToString("u"));

            return(queryString);
        }