当我查询表中的列时我没有得到结果 [英] I don't get a result when query columns in my table
问题描述
从我在Azure存储中的表中,我想检索表中的所有成年人,但是由于som原因,查询超时.为了限制它,我只取10:
From my table in Azure Storage I want to retrieve all the adults in the table, but the query times out for som reason. To limit it, I only take 10:
var query = new TableQuery< Person>().Where(TableQuery.GenerateFilterConditionForBool("IsAdult",QueryComparisons.Equal,true)). (10);
var query = new TableQuery<Person>().Where(TableQuery.GenerateFilterConditionForBool("IsAdult", QueryComparisons.Equal, true)).Take(10);
这超时了,而没有Where语句的查询运行良好:
This times out, while a query without the Where statement runs fine:
var query2 = new TableQuery< Person>().Take(10)
除非我查询PartitionKey或RowKey,否则在Azure存储中查询表是行不通的?
It does not work to query a table in Azure Storage unless i query PartitionKey or RowKey?
推荐答案
如果我使用Linq,它可以工作.添加using将使Where可以接受表达式和
If i use Linq it works. Adding the using makes the Where acceptable for expression and
var结果= table.CreateQuery< Person>()
.where(x => x.IsAdult == true)
.Take(1000)
.ToList();
var results = table.CreateQuery<Person>()
.Where(x => x.IsAdult == true)
.Take(1000)
.ToList();
为什么Linq不能工作而TableQuery不能工作?
Why does Linq work and the TableQuery not?
这篇关于当我查询表中的列时我没有得到结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!