WorkItemCollection 项目访问速度太慢

发布于 2024-09-26 15:11:14 字数 525 浏览 2 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰葑 2024-10-03 15:11:14

您的查询不会获取附件。每个 wi.Attachments 调用都会进行另一个查询来获取数据。

Your query does not fetch attachments. Each wi.Attachments call will make another query to get the data.

枉心 2024-10-03 15:11:14

好吧,您的查询指定它只需要从工作项中获取 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文