Beispiel #1
0
        internal void AddQueryLinkMode(QueryLinkMode mode)
        {
            if (_queryType != QueryType.Link)
            {
                throw new InvalidOperationException("This method is only used in case of Link query");
            }

            _queryLinkMode = mode;
        }
Beispiel #2
0
        public static WorkItemLinkInfo [] QueryLinks(
            this TfsTeamProjectCollection tpc,
            Expression <Predicate <WorkItem> > sourcePredicate,
            Expression <Predicate <WorkItem> > targetPredicate,
            string linkType,
            QueryLinkMode mode
            )
        {
            var qb = new QueryBuilder(QueryType.Link);


            var sourceLambda = sourcePredicate as LambdaExpression;
            var targetLambda = targetPredicate as LambdaExpression;


            var whereSourceTranslator = new WhereClauseTranslator(new WorkItemHelper(), "Source");

            var sourceFilter = whereSourceTranslator.Translate(sourceLambda.Body, qb, sourceLambda.Parameters[0].Name);

            if (!string.IsNullOrEmpty(sourceFilter))
            {
                qb.AddWhereClause(sourceFilter);
            }


            var whereTargetTranslator = new WhereClauseTranslator(new WorkItemHelper(), "Target");

            var targetFilter = whereTargetTranslator.Translate(sourceLambda.Body, qb, targetLambda.Parameters[0].Name);

            if (!string.IsNullOrEmpty(targetFilter))
            {
                qb.AddWhereClause(targetFilter);
            }

            qb.AddQueryLinkMode(mode);


            var q = qb.BuildQuery(tpc, null, null);

            return(q.GetLinks());
        }
Beispiel #3
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="QueryBuilder" /> class.
 /// </summary>
 public QueryBuilder(QueryType queryType)
 {
     _queryType     = queryType;
     _queryLinkMode = QueryLinkMode.MustContain;
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryBuilder"/> class.
 /// </summary>
 public QueryBuilder(QueryType queryType)
 {
     _queryType = queryType;
     _queryLinkMode = QueryLinkMode.MustContain;
 }
Beispiel #5
0
        internal void AddQueryLinkMode(QueryLinkMode mode)
        {
            if (_queryType != QueryType.Link)
            {
                throw new InvalidOperationException("This method is only used in case of Link query");
            }

            _queryLinkMode = mode;
        }