[英]What is the difference between using "Container.GetItemLinqQueryable" and "Container.GetItemQueryIterator"?
I was wondering what was the difference (performance or something else) between using either of these methods to query a cosmo container, other than using LINQ vs SQL and assuming that I use the ToFeedIterator()
method like mentioned in the docs (also below in case it changes) for Container.GetItemLinqQueryable
.我想知道除了使用 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 - Container.GetItemLinqQueryable -
This method creates a LINQ query for items in an Azure Cosmos DB service under a container.此方法为容器下的 Azure Cosmos DB 服务中的项目创建 LINQ 查询。 For asynchronous execution with FeedIterator, utilise the IQueryable extension function ToFeedIterator().对于 FeedIterator 的异步执行,使用 IQueryable 扩展 function ToFeedIterator()。
Container.GetItemQueryIterator - Container.GetItemQueryIterator -
Using a SQL statement, this method creates a query for items under a container in an Azure Cosmos database.此方法使用 SQL 语句创建对 Azure Cosmos 数据库中容器下项目的查询。 It returns a FeedIterator.它返回一个 FeedIterator。
Please refer these links for more information:请参考这些链接以获取更多信息:
Container.GetItemLinqQueryable Container.GetItemLinqQueryable
Container.GetItemQueryIterator Container.GetItemQueryIterator
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.