表存储循环如何工作?

发布于 2024-12-24 01:50:53 字数 375 浏览 4 评论 0原文

有谁知道如何从表存储中检索数据?

var result = ctx.CreateQuery<Contact>("Contacts")
                    .Where(x => x.PartitionKey == "key")
                    .Take(50)
                    .AsTableServiceQuery<Contact>().Execute();
foreach(var item in result)
{
    Console.WriteLine(item.FirstName);
}

它是从存储中获取所有项目然后循环遍历它们还是单独获取每个项目?

Does anyone knows how data is beeing retrived from table storage?

var result = ctx.CreateQuery<Contact>("Contacts")
                    .Where(x => x.PartitionKey == "key")
                    .Take(50)
                    .AsTableServiceQuery<Contact>().Execute();
foreach(var item in result)
{
    Console.WriteLine(item.FirstName);
}

Does it get all items from storage and than loops through them or it get each item separately?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

木槿暧夏七纪年 2024-12-31 01:50:53

看看下面的链接。

这一篇谈论表存储的基础知识 -
http://msdn.microsoft.com/en-us/magazine/ff796231.aspx

这个内容涵盖的内容超出了您所询问的范围,但是有一些“如何编写代码”示例可能对查询表存储有用 - http://www.windowsazure.com/en- us/develop/net/how-to-guides/table-services/

我还推荐 PDC 的这段视频。这是对 Azure 中表和队列的深入研究。 - http://www.microsoftpdc.com/2009/svc09

Take a look at the following links.

This one talks about the basics of table storage -
http://msdn.microsoft.com/en-us/magazine/ff796231.aspx

This one covers more than you are asking about, but there are some How To code examples that might be useful for querying table storage - http://www.windowsazure.com/en-us/develop/net/how-to-guides/table-services/

I also recommend this video from the PDC. It's a deep dive into tables and queues in Azure. - http://www.microsoftpdc.com/2009/svc09

筑梦 2024-12-31 01:50:53

您可以使用 Fiddler 检查这一点。表服务是 REST 服务,CreateQuery() 方法创建 REST 查询,执行 HTTP REST 调用,然后解析结果,该结果是一个 XML,其中包含查询结果中的所有实体(限制为 1000 个,如果满足以下条件,则包括继续令牌)结果超过1000)。所有项目都在结果 XML 中,没有必要从结果中查询每个项目。

You could have checked this using Fiddler. Table service is a REST Service, the CreateQuery() method creates REST Query, executes a HTTP REST Call, then parses the result, which is a XML containing all the entities in the result for the query (limit to 1000 and including continuation tokens if result is more than 1000). All the items are in the result XML, there is no point for querieng every single item from the result.

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