Skip to content

Commit 8f82a71

Browse files
Merge pull request #192589 from Venkat1340/Users/Venkat1340/Refactordocument
MSDocs: Refactor document for .NET 6
2 parents 258dc15 + f24b998 commit 8f82a71

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

articles/cosmos-db/includes/cosmos-db-emulator-vs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
author: WilliamDAssafMSFT
33
ms.service: cosmos-db
44
ms.topic: include
5-
ms.date: 11/09/2018
5+
ms.date: 03/23/2022
66
ms.author: wiassaf
77
---
8-
Download and use the free [Visual Studio 2019 Community Edition](https://www.visualstudio.com/downloads/). Make sure that you enable the **Azure development** workload during the Visual Studio setup.
8+
Download and use the free [Visual Studio 2022 Community Edition](https://visualstudio.microsoft.com/vs/community/). Make sure that you enable the **Azure development** workload during the Visual Studio setup.

articles/cosmos-db/sql/sql-api-get-started.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.service: cosmos-db
66
ms.subservice: cosmosdb-sql
77
ms.devlang: csharp
88
ms.topic: tutorial
9-
ms.date: 08/26/2021
9+
ms.date: 03/23/2022
1010
ms.author: kirankk
1111
ms.custom: devx-track-csharp
1212

@@ -23,7 +23,7 @@ ms.custom: devx-track-csharp
2323
2424
Welcome to the Azure Cosmos DB SQL API get started tutorial. After following this tutorial, you'll have a console application that creates and queries Azure Cosmos DB resources.
2525

26-
This tutorial uses version 3.0 or later of the [Azure Cosmos DB .NET SDK](https://www.nuget.org/packages/Microsoft.Azure.Cosmos). You can work with [.NET Framework or .NET Core](https://dotnet.microsoft.com/download).
26+
This tutorial uses version 3.0 or later of the [Azure Cosmos DB .NET SDK](https://www.nuget.org/packages/Microsoft.Azure.Cosmos) and [.NET 6](https://dotnet.microsoft.com/download).
2727

2828
This tutorial covers:
2929

@@ -58,11 +58,8 @@ Let's create an Azure Cosmos DB account. If you already have an account you want
5858
## <a id="SetupVS"></a>Step 2: Set up your Visual Studio project
5959

6060
1. Open Visual Studio and select **Create a new project**.
61-
1. In **Create a new project**, choose **Console App (.NET Framework)** for C#, then select **Next**.
61+
1. In **Create a new project**, choose **Console App** for C#, then select **Next**.
6262
1. Name your project *CosmosGettingStartedTutorial*, and then select **Create**.
63-
64-
:::image type="content" source="./media/sql-api-get-started/configure-cosmos-getting-started-2019.png" alt-text="Configure your project":::
65-
6663
1. In the **Solution Explorer**, right-click your new console application, which is under your Visual Studio solution, and select **Manage NuGet Packages**.
6764
1. In the **NuGet Package Manager**, select **Browse** and search for *Microsoft.Azure.Cosmos*. Choose **Microsoft.Azure.Cosmos** and select **Install**.
6865

@@ -159,7 +156,7 @@ A database is the logical container of items partitioned across containers. Eith
159156

160157
[!code-csharp[](~/cosmos-dotnet-getting-started/CosmosGettingStartedTutorial/Program.cs?name=CreateDatabaseAsync&highlight=7)]
161158

162-
`CreateDatabaseAsync` creates a new database with ID `FamilyDatabase` if it doesn't already exist, that has the ID specified from the `databaseId` field.
159+
`CreateDatabaseAsync` creates a new database with ID `FamilyDatabase` if it doesn't already exist, that has the ID specified from the `databaseId` field. For the purpose of this demo we are creating the database as part of the exercise, but on applications in production, it is [not recommended to do it as part of the normal flow](troubleshoot-dot-net-sdk-slow-request.md#metadata-operations).
163160

164161
1. Copy and paste the code below where you instantiate the CosmosClient to call the **CreateDatabaseAsync** method you just added.
165162

@@ -214,10 +211,9 @@ A database is the logical container of items partitioned across containers. Eith
214211
Program p = new Program();
215212
await p.GetStartedDemoAsync();
216213
}
217-
catch (CosmosException de)
214+
catch (CosmosException cosmosException)
218215
{
219-
Exception baseException = de.GetBaseException();
220-
Console.WriteLine("{0} error occurred: {1}\n", de.StatusCode, de);
216+
Console.WriteLine("Cosmos Exception with Status {0} : {1}\n", cosmosException.StatusCode, cosmosException);
221217
}
222218
catch (Exception e)
223219
{
@@ -276,7 +272,7 @@ Congratulations! You've successfully created an Azure Cosmos database.
276272

277273
A container can be created by using either the [**CreateContainerIfNotExistsAsync**](/dotnet/api/microsoft.azure.cosmos.database.createcontainerifnotexistsasync#Microsoft_Azure_Cosmos_Database_CreateContainerIfNotExistsAsync_Microsoft_Azure_Cosmos_ContainerProperties_System_Nullable_System_Int32__Microsoft_Azure_Cosmos_RequestOptions_System_Threading_CancellationToken_) or [**CreateContainerAsync**](/dotnet/api/microsoft.azure.cosmos.database.createcontainerasync#Microsoft_Azure_Cosmos_Database_CreateContainerAsync_Microsoft_Azure_Cosmos_ContainerProperties_System_Nullable_System_Int32__Microsoft_Azure_Cosmos_RequestOptions_System_Threading_CancellationToken_) method in the `CosmosDatabase` class. A container consists of items (JSON documents if SQL API) and associated server-side application logic in JavaScript, for example, stored procedures, user-defined functions, and triggers.
278274

279-
1. Copy and paste the `CreateContainerAsync` method below your `CreateDatabaseAsync` method. `CreateContainerAsync` creates a new container with the ID `FamilyContainer` if it doesn't already exist, by using the ID specified from the `containerId` field partitioned by `LastName` property.
275+
1. Copy and paste the `CreateContainerAsync` method below your `CreateDatabaseAsync` method. `CreateContainerAsync` creates a new container with the ID `FamilyContainer` if it doesn't already exist, by using the ID specified from the `containerId` field partitioned by `LastName` property. For the purpose of this demo we are creating the container as part of the exercise, but on applications in production, it is [not recommended to do it as part of the normal flow](troubleshoot-dot-net-sdk-slow-request.md#metadata-operations).
280276

281277
[!code-csharp[](~/cosmos-dotnet-getting-started/CosmosGettingStartedTutorial/Program.cs?name=CreateContainerAsync&highlight=9)]
282278

0 commit comments

Comments
 (0)