![](/img/trans.png)
[英]What is the difference between commands and container_commands configuration keys in Beanstalk?
[英]What is the difference between using "Container.GetItemLinqQueryable" and "Container.GetItemQueryIterator"?
我想知道除了使用 LINQ 和 SQL 之外,使用这些方法中的任何一种来查询 cosmo 容器之间有什么区别(性能或其他),并假设我使用文档中提到的ToFeedIterator()
方法(也在下面情况下它改变)对于Container.GetItemLinqQueryable
。
// LINQ query generation
using (FeedIterator<Book> setIterator = container.GetItemLinqQueryable<Book>()
.Where(b => b.Title == "War and Peace")
.ToFeedIterator())
{
//Asynchronous query execution
while (setIterator.HasMoreResults)
{
foreach(var item in await setIterator.ReadNextAsync())
{
Console.WriteLine(item.Price);
}
}
}
Container.GetItemLinqQueryable -
此方法为容器下的 Azure Cosmos DB 服务中的项目创建 LINQ 查询。 对于 FeedIterator 的异步执行,使用 IQueryable 扩展 function ToFeedIterator()。
Container.GetItemQueryIterator -
此方法使用 SQL 语句创建对 Azure Cosmos 数据库中容器下项目的查询。 它返回一个 FeedIterator。
请参考这些链接以获取更多信息:
Container.GetItemLinqQueryable
Container.GetItemQueryIterator
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.