WorkItemCollection 项目访问速度太慢
使用 TFS SDK,我使用 WorkItemStore.Query
查询工作项:
WorkItemCollection workItems = WorkItemStore.Query("SELECT ID from workitems");
foreach(WorkItem wi in workItems)
{
string Id = wi.Id;
foreach(Attachment attachment in wi.Attachments)
{
Console.Write(attachment.Uri.OriginalString); //SLOW
}
}
从集合中访问项目太慢。每次我访问 WorkItem 成员时它都会与 TFS 服务器通信吗?有没有一种方法可以构建我的查询,使其一次性获得我需要的所有字段?
问题是,TFS 服务器位于离岸,这就是它速度慢的原因。批量查询内容会使其速度更快。
编辑:我无法查询附件字段。 “附件”不是有效字段。
Using TFS SDK, I am querying workitems using WorkItemStore.Query
:
WorkItemCollection workItems = WorkItemStore.Query("SELECT ID from workitems");
foreach(WorkItem wi in workItems)
{
string Id = wi.Id;
foreach(Attachment attachment in wi.Attachments)
{
Console.Write(attachment.Uri.OriginalString); //SLOW
}
}
Accessing items from the collection is too slow. Is it talking to the TFS server everytime I access a WorkItem member? Is there a way to construct my query in such a way that it will get all the fields that I need in one go?
Problem is, the TFS server is located off-shore, and that's why it's slow. Querying stuff en-masse makes it a lot faster.
EDIT: I can't query the attachments field. "attachments" is not a valid field.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的查询不会获取附件。每个 wi.Attachments 调用都会进行另一个查询来获取数据。
Your query does not fetch attachments. Each wi.Attachments call will make another query to get the data.
好吧,您的查询指定它只需要从工作项中获取 ID。正如您所问的,我怀疑请求您想要的所有信息会更有效,因为它需要在返回之前收集所有信息。
Well, your query specifies that it only needs to grab the ID from the workitems. As you asked, I would suspect that requesting all the information that you want would be more efficient, as it would need to gather all of it before it returned.