表存储循环如何工作?
有谁知道如何从表存储中检索数据?
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看下面的链接。
这一篇谈论表存储的基础知识 -
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
您可以使用 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.