This commit is contained in:
kirankumarkolli 2019-05-10 22:22:54 +05:30 коммит произвёл GitHub
Родитель af7008115b
Коммит cda890337e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -179,7 +179,7 @@
{
Console.WriteLine("\n5. Reading all CosmosContainer resources for a database");
CosmosResultSetIterator<CosmosContainerSettings> resultSetIterator = database.Containers.GetContainerIterator();
CosmosFeedIterator<CosmosContainerSettings> resultSetIterator = database.Containers.GetContainerIterator();
while (resultSetIterator.HasMoreResults)
{
foreach (CosmosContainerSettings container in await resultSetIterator.FetchNextSetAsync())

Просмотреть файл

@ -90,7 +90,7 @@
}
Console.WriteLine("\n5. Reading all databases resources for an account");
CosmosResultSetIterator<CosmosDatabaseSettings> iterator = client.Databases.GetDatabaseIterator();
CosmosFeedIterator<CosmosDatabaseSettings> iterator = client.Databases.GetDatabaseIterator();
do
{
foreach (CosmosDatabaseSettings db in await iterator.FetchNextSetAsync())

Просмотреть файл

@ -80,11 +80,11 @@
await container.Items.ReplaceItemAsync<Item>(item.Id, item.Id, item);
// Querying
CosmosResultSetIterator<Item> query = container.Items.CreateItemQuery<Item>(new CosmosSqlQueryDefinition("SELECT * FROM c"), maxConcurrency: 1);
CosmosFeedIterator<Item> query = container.Items.CreateItemQuery<Item>(new CosmosSqlQueryDefinition("SELECT * FROM c"), maxConcurrency: 1);
List<Item> results = new List<Item>();
while (query.HasMoreResults)
{
CosmosQueryResponse<Item> response = await query.FetchNextSetAsync();
CosmosFeedResponse<Item> response = await query.FetchNextSetAsync();
results.AddRange(response.ToList());
}

Просмотреть файл

@ -235,7 +235,7 @@
"select * from sales s where s.AccountNumber = @AccountInput ")
.UseParameter("@AccountInput", "Account1");
CosmosResultSetIterator<SalesOrder> resultSet = container.Items.CreateItemQuery<SalesOrder>(
CosmosFeedIterator<SalesOrder> resultSet = container.Items.CreateItemQuery<SalesOrder>(
query,
partitionKey: "Account1",
maxItemCount: 1);
@ -251,7 +251,7 @@
Console.WriteLine($"\n1.4.2 Query found {allSalesForAccount1.Count} items.");
// Use the same query as before but get the cosmos response message to access the stream directly
CosmosResultSetIterator streamResultSet = container.Items.CreateItemQueryAsStream(
CosmosFeedIterator streamResultSet = container.Items.CreateItemQueryAsStream(
query,
maxConcurrency: 1,
partitionKey: "Account1",
@ -260,10 +260,10 @@
List<SalesOrder> allSalesForAccount1FromStream = new List<SalesOrder>();
while (streamResultSet.HasMoreResults)
{
using (CosmosQueryResponse responseMessage = await streamResultSet.FetchNextSetAsync())
using (CosmosResponseMessage responseMessage = await streamResultSet.FetchNextSetAsync())
{
// Item stream operations do not throw exceptions for better performance
if (responseMessage.IsSuccess)
if (responseMessage.IsSuccessStatusCode)
{
dynamic streamResponse = FromStream<dynamic>(responseMessage.Content);
List<SalesOrder> salesOrders = streamResponse.ToObject<List<SalesOrder>>();

Просмотреть файл

@ -96,7 +96,7 @@
List<Family> families = new List<Family>();
// SQL
CosmosResultSetIterator<Family> setIterator = container.Items.GetItemIterator<Family>(maxItemCount: 1);
CosmosFeedIterator<Family> setIterator = container.Items.GetItemIterator<Family>(maxItemCount: 1);
while (setIterator.HasMoreResults)
{
int count = 0;
@ -115,7 +115,7 @@
int totalCount = 0;
// SQL
CosmosFeedResultSetIterator setIterator = container.Items.GetItemStreamIterator();
CosmosFeedIterator setIterator = container.Items.GetItemStreamIterator();
while (setIterator.HasMoreResults)
{
int count = 0;
@ -140,7 +140,7 @@
private static async Task QueryItemsInPartitionAsStreams(CosmosContainer container)
{
// SQL
CosmosResultSetIterator setIterator = container.Items.CreateItemQueryAsStream(
CosmosFeedIterator setIterator = container.Items.CreateItemQueryAsStream(
"SELECT F.id, F.LastName, F.IsRegistered FROM Families F",
partitionKey: "Anderson",
maxConcurrency: 1,
@ -149,9 +149,9 @@
int count = 0;
while (setIterator.HasMoreResults)
{
using (CosmosQueryResponse response = await setIterator.FetchNextSetAsync())
using (CosmosResponseMessage response = await setIterator.FetchNextSetAsync())
{
Assert("Response failed", response.IsSuccess);
Assert("Response failed", response.IsSuccessStatusCode);
count++;
using (StreamReader sr = new StreamReader(response.Content))
using (JsonTextReader jtr = new JsonTextReader(sr))
@ -178,7 +178,7 @@
.UseParameter("@city", "Seattle");
List<Family> results = new List<Family>();
CosmosResultSetIterator<Family> resultSetIterator = container.Items.CreateItemQuery<Family>(query, partitionKey: "Anderson");
CosmosFeedIterator<Family> resultSetIterator = container.Items.CreateItemQuery<Family>(query, partitionKey: "Anderson");
while (resultSetIterator.HasMoreResults)
{
results.AddRange((await resultSetIterator.FetchNextSetAsync()));
@ -195,7 +195,7 @@
// 0 maximum parallel tasks, effectively serial execution
CosmosQueryRequestOptions options = new CosmosQueryRequestOptions() { MaxBufferedItemCount = 100 };
CosmosResultSetIterator<Family> query = container.Items.CreateItemQuery<Family>(
CosmosFeedIterator<Family> query = container.Items.CreateItemQuery<Family>(
queryText,
maxConcurrency: 0,
requestOptions: options);

Просмотреть файл

@ -182,10 +182,10 @@
// 8. Validate
int numDocs = 0;
CosmosResultSetIterator<dynamic> setIterator = container.Items.GetItemIterator<dynamic>();
CosmosFeedIterator<dynamic> setIterator = container.Items.GetItemIterator<dynamic>();
while (setIterator.HasMoreResults)
{
CosmosQueryResponse<dynamic> response = await setIterator.FetchNextSetAsync();
CosmosFeedResponse<dynamic> response = await setIterator.FetchNextSetAsync();
numDocs += response.Count();
}