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 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 -
This method creates a LINQ query for items in an Azure Cosmos DB service under a container. For asynchronous execution with FeedIterator, utilise the IQueryable extension function ToFeedIterator().
Container.GetItemQueryIterator -
Using a SQL statement, this method creates a query for items under a container in an Azure Cosmos database. It returns a FeedIterator.
Please refer these links for more information:
Container.GetItemLinqQueryable
Container.GetItemQueryIterator
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.