Linq To WIQL

Linq To WIQL is a specific implementation of LINQ to build WIQL request. This C# Linq code:

string searchString = "fissum";

 

var q = (from wi in server.WorkItems()

        where

            wi.Title.Contains(searchString) ||

            wi.History.Contains(searchString) ||

            wi.Description.Contains(searchString)

        orderby wi.CreatedDate descending

        select new { Id = wi.Id, Title = wi.Title, CreatedDate = wi.CreatedDate }

        ).ToList();

is transformed in this WIQL query:

SELECT [System.Id]
FROM WORKITEMS
WHERE ((([System.Title] contains @P0 OR [System.History] contains @P1) OR [System.Description] contains @P2))
ORDER BY [System.CreatedDate] desc

The select clause is not used to generate work item result list by the TFS assembly so I limit it to the minimum.

Linq To WIQL is used by Fissum in the word search feature in the "Quick Go To" window.

In the example the request is server based request, but it can be limited to a specific project. With the Fissum preview,  Linq To WIQL comes with model generator tools : these tools creates classes over the WorkItem class of the Fissum API to handle the specific fields of the templates.

Print | posted on Wednesday, April 23, 2008 3:11 PM

Comments have been closed on this topic.