Skip to content

Commit c41497c

Browse files
committed
Updating language
1 parent 7bca70b commit c41497c

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

articles/cosmos-db/create-sql-api-dotnet-v4.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,64 +145,64 @@ To learn in more about the hierarchy of different entities, see the [working wit
145145

146146
The sample code described in this article creates a family database in Azure Cosmos DB. The family database contains family details such as name, address, location, the associated parents, children, and pets. Before populating the data to your Azure Cosmos account, define the properties of a family item. Create a new class named `Family.cs` at the root level of your sample application and add the following code to it:
147147

148-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Family.cs)]
148+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Family.cs":::
149149

150150
### Add the using directives & define the client object
151151

152152
From the project directory, open the `Program.cs` file in your editor and add the following using directives at the top of your application:
153153

154-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=Usings)]
154+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="Usings":::
155155

156156

157157
Add the following global variables in your `Program` class. These will include the endpoint and authorization keys, the name of the database, and container that you will create. Make sure to replace the endpoint and authorization keys values according to your environment.
158158

159-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=Constants)]
159+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="Constants":::
160160

161161
Finally, replace the `Main` method:
162162

163-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=Main)]
163+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="Main":::
164164

165165
### Create a database
166166

167167
Define the `CreateDatabaseAsync` method within the `program.cs` class. This method creates the `FamilyDatabase` if it doesn't already exist.
168168

169-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=CreateDatabaseAsync)]
169+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="CreateDatabaseAsync":::
170170

171171
### Create a container
172172

173173
Define the `CreateContainerAsync` method within the `Program` class. This method creates the `FamilyContainer` if it doesn't already exist.
174174

175-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=CreateContainerAsync)]
175+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="CreateContainerAsync":::
176176

177177
### Create an item
178178

179179
Create a family item by adding the `AddItemsToContainerAsync` method with the following code. You can use the `CreateItemAsync` or `UpsertItemAsync` methods to create an item:
180180

181-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=AddItemsToContainerAsync)]
181+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="AddItemsToContainerAsync":::
182182

183183
### Query the items
184184

185185
After inserting an item, you can run a query to get the details of "Andersen" family. The following code shows how to execute the query using the SQL query directly. The SQL query to get the "Anderson" family details is: `SELECT * FROM c WHERE c.LastName = 'Andersen'`. Define the `QueryItemsAsync` method within the `Program` class and add the following code to it:
186186

187-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=QueryItemsAsync)]
187+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="QueryItemsAsync":::
188188

189189
### Replace an item
190190

191191
Read a family item and then update it by adding the `ReplaceFamilyItemAsync` method with the following code.
192192

193-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=ReplaceFamilyItemAsync)]
193+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="ReplaceFamilyItemAsync":::
194194

195195
### Delete an item
196196

197197
Delete a family item by adding the `DeleteFamilyItemAsync` method with the following code.
198198

199-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=DeleteFamilyItemAsync)]
199+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="DeleteFamilyItemAsync":::
200200

201201
### Delete the database
202202

203203
Finally you can delete the database adding the `DeleteDatabaseAndCleanupAsync` method with the following code:
204204

205-
[!code-csharp[Main](~/cosmos-dotnet-v4-getting-started/src/Program.cs?name=DeleteDatabaseAndCleanupAsync)]
205+
:::code language="csharp" source="~/cosmos-dotnet-v4-getting-started/src/Program.cs" id="DeleteDatabaseAndCleanupAsync":::
206206

207207
After you add all the required methods, save the `Program` file.
208208

0 commit comments

Comments
 (0)