You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Note that after creating the item, we can access the body of the item with the Resource property off the ItemResponse. We can also access the RequestCharge property to see the amount of RUs consumed on this request.
373
-
Console.WriteLine("Created item in database with id: {0} Operation consumed {1} RUs.\n", andersenFamilyResponse.Resource.Id, andersenFamilyResponse.RequestCharge);
374
-
}
361
+
try
362
+
{
363
+
// Create an item in the container representing the Andersen family. Note we provide the value of the partition key for this item, which is "Andersen".
// Note that after creating the item, we can access the body of the item with the Resource property of the ItemResponse. We can also access the RequestCharge property to see the amount of RUs consumed on this request.
366
+
Console.WriteLine("Created item in database with id: {0} Operation consumed {1} RUs.\n", andersenFamilyResponse.Resource.Id, andersenFamilyResponse.RequestCharge);
367
+
}
368
+
catch (CosmosExceptionex) when (ex.StatusCode==HttpStatusCode.Conflict)
369
+
{
370
+
Console.WriteLine("Item in database with id: {0} already exists\n", andersenFamily.Id);
0 commit comments