2012-09-20 47 views
0
Public ReadOnly Property logs() As CloudTableQuery(Of adlog) 
Get 
Return CreateQuery(Of adlog)("adlog").AsTableServiceQuery() 
End Get 
End Property 

我有下面的代码执行()CloudTableQuery的功能似乎无限

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

回答

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. 
+0

Execute()在参数之前是键,谢谢纯逻辑。 –