diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/CFPullModelAllVersionsAndDeletesMode/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/CFPullModelAllVersionsAndDeletesMode/Program.cs index e6f86b9ed4..676e344256 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/CFPullModelAllVersionsAndDeletesMode/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/CFPullModelAllVersionsAndDeletesMode/Program.cs @@ -60,12 +60,12 @@ static async Task CreateAllVersionsAndDeletesChangeFeedIterator(Containe Console.WriteLine("Creating ChangeFeedIterator to read the change feed in All Versions and Deletes mode."); // - using (FeedIterator> allVersionsIterator = container - .GetChangeFeedIterator>(ChangeFeedStartFrom.Now(), ChangeFeedMode.AllVersionsAndDeletes)) + using (FeedIterator allVersionsIterator = container + .GetChangeFeedIterator(ChangeFeedStartFrom.Now(), ChangeFeedMode.AllVersionsAndDeletes)) { while (allVersionsIterator.HasMoreResults) { - FeedResponse> response = await allVersionsIterator.ReadNextAsync(); + FeedResponse response = await allVersionsIterator.ReadNextAsync(); if (response.StatusCode == HttpStatusCode.NotModified) { @@ -134,11 +134,11 @@ static async Task ReadAllVersionsAndDeletesChangeFeed(Container container, strin Console.WriteLine("Press any key to stop."); // - using (FeedIterator> allVersionsIterator = container.GetChangeFeedIterator>(ChangeFeedStartFrom.ContinuationToken(allVersionsContinuationToken), ChangeFeedMode.AllVersionsAndDeletes, new ChangeFeedRequestOptions { PageSizeHint = 10 })) + using (FeedIterator allVersionsIterator = container.GetChangeFeedIterator(ChangeFeedStartFrom.ContinuationToken(allVersionsContinuationToken), ChangeFeedMode.AllVersionsAndDeletes, new ChangeFeedRequestOptions { PageSizeHint = 10 })) { while (allVersionsIterator.HasMoreResults) { - FeedResponse> response = await allVersionsIterator.ReadNextAsync(); + FeedResponse response = await allVersionsIterator.ReadNextAsync(); if (response.StatusCode == HttpStatusCode.NotModified) { @@ -147,25 +147,21 @@ static async Task ReadAllVersionsAndDeletesChangeFeed(Container container, strin } else { - foreach (ChangeFeedItem item in response) + foreach (dynamic item in response) { // if operaiton is delete - if (item.Metadata.OperationType == ChangeFeedOperationType.Delete) + if (item.metadata.operationType == "delete") { - if (item.Metadata.IsTimeToLiveExpired == true) - { - Console.WriteLine($"Operation: {item.Metadata.OperationType} (due to TTL). Item id: {item.Previous.Id}. Previous value: {item.Previous.Value}"); - } - else - { - Console.WriteLine($"Operation: {item.Metadata.OperationType} (not due to TTL). Item id: {item.Previous.Id}. Previous value: {item.Previous.Value}"); - } + bool isTTL = (item.metadata?.timeToLiveExpired == null) ? false : true; + Console.WriteLine($"Operation: {item.metadata.operationType}. Item id: {item.metadata.id}. Due to ttl: {isTTL}"); } // if operation is create or replace else { - Console.WriteLine($"Operation: {item.Metadata.OperationType}. Item id: {item.Current.Id}. Current value: {item.Current.Value}"); + Console.WriteLine($"Operation: {item.metadata.operationType}. Item id: {item.current.Id}. Current value: {item.current.Value}"); } + + Console.WriteLine($"{item}"); } } diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes/Program.cs index 309316997b..9cb88d133e 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes/Program.cs +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes/Program.cs @@ -350,7 +350,7 @@ static async Task HandleChangesAsync(ChangeFeedProcessorContext context, IReadOn { if (item.Metadata.OperationType == ChangeFeedOperationType.Delete) { - Console.WriteLine($"\tDetected {item.Metadata.OperationType} operation for item with id {item.Previous.id}."); + Console.WriteLine($"\tDetected {item.Metadata.OperationType} operation for item."); } else {