From 6a45db9605ce09d6188dec7c4411e5484ae886d1 Mon Sep 17 00:00:00 2001 From: Sidney Andrews Date: Tue, 10 Oct 2023 21:43:35 -0400 Subject: [PATCH] Update comment section names --- src/web/Pages/Index.razor | 23 +++++++++++++---------- src/web/Program.cs | 7 +++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/web/Pages/Index.razor b/src/web/Pages/Index.razor index 9f498f2..8039633 100644 --- a/src/web/Pages/Index.razor +++ b/src/web/Pages/Index.razor @@ -38,18 +38,20 @@ await WriteToConsoleAync("Current Status:\tStarting..."); - // + // Database database = client.GetDatabase("cosmicworks"); - // + // + database = await database.ReadAsync(); await WriteToConsoleAync($"Get database:\t{database.Id}"); - // + // Container container = database.GetContainer("products"); - // + // + container = await container.ReadContainerAsync(); await WriteToConsoleAync($"Get container:\t{container.Id}"); { - // + // Product item = new( id: "68719518391", category: "gear-surf-surfboards", @@ -63,7 +65,7 @@ item: item, partitionKey: new PartitionKey("gear-surf-surfboards") ); - // + // await WriteToConsoleAync($"Upserted item:\t{response.Resource}"); await WriteToConsoleAync($"Status code:\t{response.StatusCode}"); await WriteToConsoleAync($"Request charge:\t{response.RequestCharge:0.00}"); @@ -89,12 +91,12 @@ } { - // + // ItemResponse response = await container.ReadItemAsync( id: "68719518391", partitionKey: new PartitionKey("gear-surf-surfboards") ); - // + // await WriteToConsoleAync($"Read item id:\t{response.Resource.id}"); await WriteToConsoleAync($"Read item:\t{response.Resource}"); await WriteToConsoleAync($"Status code:\t{response.StatusCode}"); @@ -102,7 +104,7 @@ } { - // + // var query = new QueryDefinition( query: "SELECT * FROM products p WHERE p.category = @category" ) @@ -118,11 +120,12 @@ FeedResponse response = await feed.ReadNextAsync(); foreach (Product item in response) { + // Do something with each item await WriteToConsoleAync($"Found item:\t{item.name}\t[{item.id}]"); } await WriteToConsoleAync($"Request charge:\t{response.RequestCharge:0.00}"); } - // + // } await WriteToConsoleAync("Current Status:\tStopping..."); diff --git a/src/web/Program.cs b/src/web/Program.cs index 5238757..4660ef4 100644 --- a/src/web/Program.cs +++ b/src/web/Program.cs @@ -6,12 +6,15 @@ builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton((_) => +{ // - new CosmosClient( + CosmosClient client = new( accountEndpoint: builder.Configuration["AZURE_COSMOS_DB_NOSQL_ENDPOINT"]!, tokenCredential: new DefaultAzureCredential() + ); // -)); + return client; +}); var app = builder.Build();