0
Public ReadOnly Property logs() As CloudTableQuery(Of adlog)
Get
Return CreateQuery(Of adlog)("adlog").AsTableServiceQuery()
End Get
End Property

我有以下代码

Dim oContext = New kdlib.kdlogs.adlog_context()
Dim q = From adlogs In oContext.logs Where adlogs.PartitionKey = "xxxxxx"

只会带回 1000 行

如果我在.Execute()某处阅读时添加:

Dim q = From adlogs In oContext.logs.Execute() Where adlogs.PartitionKey = "xxxxxx"

请求永无止境

我真的不明白。

根据下面的成功答案进行编辑

现在在这里工作

Dim azt_context As New tableContextGet
Dim azt_query As CloudTableQuery(Of adlog)
azt_query = azt_context.CreateQuery(Of adlog)("adlog").Where(Function(e) (e.PartitionKey = "xxx")).AsTableServiceQuery()
Dim azt_result = azt_query.Execute()

然后 azt_result.ToList

4

1 回答 1

0

第一个查询会将查询参数发送到存储服务器,存储服务器会将过滤结果发送给您。

您的第二个查询试图从表中提取所有数据,然后在内存中对其进行过滤。那是因为oContext.logs.Execute()将立即执行查询,没有参数。顺便说一句,它可能会完成,尽管可能需要很长时间。

通常,您希望先设置查询,然后调用 .AsTableServiceQuery(),然后获取结果。我真的不知道 VB.NET,但这应该给你一个大致的想法:

Public ReadOnly Property logs() As CloudTableQuery(Of adlog)
Get
Return CreateQuery(Of adlog)("adlog")
End Get
End Property

...

Dim oContext = New kdlib.kdlogs.adlog_context() 
Dim q = From adlogs In oContext.logs Where adlogs.PartitionKey = "xxxxxx"
Dim qQuery = q.AsTableServiceContext() //Do this after setting up parameters
Dim qResult = q.ToList()  //Actually executes the query.
于 2012-09-20T22:40:23.690 回答