当前位置: 首页>>代码示例>>C#>>正文


C# Query.EndQuery方法代码示例

本文整理汇总了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;
        }
开发者ID:mongeon,项目名称:TFSNotifier,代码行数:9,代码来源:TFSRepository.cs

示例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);
 }
开发者ID:slashP,项目名称:Tfs2Trello,代码行数:14,代码来源:TfsClient.cs

示例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);            
        }
开发者ID:ERPDevelopment,项目名称:LeanKit.IntegrationService,代码行数:80,代码来源:Tfs.cs


注:本文中的Query.EndQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。