本文整理汇总了C#中Query.EndQuery方法的典型用法代码示例。如果您正苦于以下问题:C# Query.EndQuery方法的具体用法?C# Query.EndQuery怎么用?C# Query.EndQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Query
的用法示例。
在下文中一共展示了Query.EndQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWorkItems
public WorkItemCollection GetWorkItems(WorkItemStore wit, string wiql)
{
Query qry = new Query(wit, wiql, null, false);
ICancelableAsyncResult car = qry.BeginQuery();
WorkItemCollection items = qry.EndQuery(car);
return items;
}
示例2: GetTfsWorkItemsToUpdate
public IEnumerable<TfsWorkItem> GetTfsWorkItemsToUpdate()
{
var workItemStore = GetWorkItemStore();
var wiql = String.Format(@"
Select [State], [Title]
From WorkItems
Where [Iteration Path] = '{0}'
And [Work Item Type] IN ({1})
And [Changed Date] > '{2}'
And [Team Project] = '{3}'", _trelloConfig.Iteration, WorkItemTypes, _lastUpdate, _trelloConfig.TfsProject);
var query = new Query(workItemStore, wiql, null, false);
var cancellation = query.BeginQuery();
return query.EndQuery(cancellation).Cast<WorkItem>().Select(ToTfsWorkItem);
}
示例3: Synchronize
protected override void Synchronize(BoardMapping project)
{
Log.Debug("Polling TFS [{0}] for Work Items", project.Identity.TargetName);
//query a project for new items
var stateQuery = string.Format(" AND ({0})", String.Join(" or ", project.QueryStates.Select(x => "[System.State] = '" + x.Trim() + "'").ToList()));
var iterationQuery = "";
if (!string.IsNullOrEmpty(project.IterationPath))
{
iterationQuery = string.Format(" AND [System.IterationPath] UNDER '{0}' ", project.IterationPath);
}
var queryAsOfDate = QueryDate.AddMilliseconds(Configuration.PollingFrequency*-1.5).ToString("o");
string tfsQuery;
if (!string.IsNullOrEmpty(project.Query))
{
tfsQuery = string.Format(project.Query, queryAsOfDate);
}
else
{
tfsQuery = String.Format(
"[System.TeamProject] = '{0}' {1} {2} {3} and [System.ChangedDate] > '{4}'",
project.Identity.TargetName, iterationQuery, stateQuery, project.ExcludedTypeQuery, queryAsOfDate);
}
var queryStr = string.Format("SELECT [System.Id], [System.WorkItemType]," +
" [System.State], [System.AssignedTo], [System.Title], [System.Description]" +
" FROM WorkItems " +
" WHERE {0}" +
" ORDER BY [System.TeamProject]", tfsQuery);
if (_projectCollectionWorkItemStore == null)
{
"Reconnecting to TFS...".Info();
Init();
}
Query query;
try
{
query = new Query(_projectCollectionWorkItemStore, queryStr, null, false);
}
catch (Exception ex)
{
Log.Error("Error creating TFS query. {0} ", ex.Message);
if (_projectCollectionWorkItemStore == null) Log.Error("Project Collection Work Item Store is null");
throw;
}
var cancelableAsyncResult = query.BeginQuery();
var changedItems = query.EndQuery(cancelableAsyncResult);
Log.Info("\nQuery [{0}] for changes after {1}", project.Identity.Target, queryAsOfDate);
Log.Debug(queryStr);
foreach (WorkItem item in changedItems)
{
Log.Info("Work Item [{0}]: {1}, {2}, {3}",
item.Id, item.Title, item.Fields["System.AssignedTo"].Value, item.State);
// does this workitem have a corresponding card?
var card = LeanKit.GetCardByExternalId(project.Identity.LeanKit, item.Id.ToString(CultureInfo.InvariantCulture));
if (card == null || !card.ExternalSystemName.Equals(ServiceName, StringComparison.OrdinalIgnoreCase))
{
Log.Debug("Creating new card for work item [{0}]", item.Id);
CreateCardFromWorkItem(project, item);
}
// TODO: else if Lane = defined end lane then update it in TFS (i.e. we missed the event)
// call UpdateStateOfExternalWorkItem()
else
{
Log.Info("Previously created a card for work item[{0}]", item.Id);
if (project.UpdateCards)
WorkItemUpdated(item, card, project);
else
Log.Info("Skipped card update because 'UpdateCards' is disabled.");
}
}
Log.Info("{0} item(s) queried.\n", changedItems.Count);
}