Skip to content

Commit 55a5128

Browse files
authored
Update quickstart-dotnet.md
1 parent b3944ae commit 55a5128

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

articles/cosmos-db/nosql/quickstart-dotnet.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ The code to access database resources is in the `GenerateQueryDataAsync` method
310310
311311
Use the <xref:Microsoft.Azure.Cosmos.CosmosClient.GetDatabase%2A> method to return a reference to the specified database.
312312
313-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="get_database":::
313+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="get_database":::
314314
315315
### Get a container
316316
317317
The code to access container resources is also in the `GenerateQueryDataAsync` method.
318318
319319
The <xref:Microsoft.Azure.Cosmos.Database.GetContainer%2A> returns a reference to the specified container.
320320
321-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="get_container":::
321+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="get_container":::
322322
323323
### Create an item
324324
@@ -328,24 +328,24 @@ The easiest way to create a new item in a container is to first build a C# class
328328
329329
In the `GenerateQueryDataAsync` method, create an item in the container by calling <xref:Microsoft.Azure.Cosmos.Container.UpsertItemAsync%2A>.
330330
331-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="create_item":::
331+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="create_item":::
332332
333333
### Read an item
334334
335335
In Azure Cosmos DB, you can perform a point read operation by using both the unique identifier (`id`) and partition key fields. In the SDK, call <xref:Microsoft.Azure.Cosmos.Container.ReadItemAsync%2A> passing in both values to return a deserialized instance of your C# type.
336336
Still in the `GenerateQueryDataAsync` method, use `ReadItemAsync<Product>` to serialize the item using the `Product` type.
337337
338-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="read_item":::
338+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="read_item":::
339339
340340
### Query items
341341
342342
After you insert an item, you can run a query to get all items that match a specific filter. This example runs the SQL query: `SELECT * FROM products p WHERE p.category = "gear-surf-surfboards"`. This example uses the QueryDefinition type and a parameterized query expression for the partition key filter. Once the query is defined, call <xref:Microsoft.Azure.Cosmos.Container.GetItemQueryIterator%2A> to get a result iterator that manages the pages of results. In the example, the query logic is also in the `GenerateQueryDataAsync` method.
343343
344-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="query_items":::
344+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="query_items":::
345345
346346
Then, use a combination of `while` and `foreach` loops to retrieve pages of results and then iterate over the individual items.
347347
348-
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Pages/Index.razor" id="parse_results":::
348+
:::code language="csharp" source="~/cosmos-db-nosql-dotnet-quickstart/src/web/Services/CosmosDbService.cs" id="parse_results":::
349349
350350
## Clean up resources
351351

0 commit comments

Comments
 (0)