Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# cosmos db add items into container

using Microsoft.Azure.Cosmos

public class Test
{
	[JsonProperty(PropertyName = "CategoryId")]
	public int Id { get; set; }
}

public async Task AddItemsAsync(CosmosClient cosmosClient, Database database, Container container)
{

	Test test = new Test();
	test.Id = 0;

	ItemResponse<Test> testResponse = await container.CreateItemAsync<Test>(test, new PartitionKey("<Your partition key>"));

	Console.WriteLine("Created item in database with id: {0} Operation consumed {1} RUs.
"
		, testResponse.Resource.Id, testResponse.RequestCharge);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: How to keep line breaks in SQL Server using ASP.NET and C#? 
Csharp :: Dictionary of array in C# 
Csharp :: missing integer c# 
Csharp :: anidate bucle in c# 
Csharp :: Computing a Cartesian product or Combinations with LINQ 
Csharp :: C# Fibonacci list 
Csharp :: auto scroll infinite scroller unity 
Csharp :: can you use unity for ftee 
Csharp :: Handling aggregation responses with NEST c# 
Csharp :: unity C# add torque to rigidbody 
Csharp :: esc exit winform 
Csharp :: use Multiple forms in one Csharp panel in one Windows Form panel 
Csharp :: c# get buttons row and column in grid 
Csharp :: get centerpoint of points transforms 
Csharp :: Garbage collect every 30 frames unity 
Csharp :: c# call constructor from constructor 
Csharp :: c# async rethrow exception 
Csharp :: send to main args dotnet debug 
Csharp :: card caption 
Csharp :: how to input data several times in c# 
Csharp :: wpf settings core 
Csharp :: make wpf run in fullscreen but above windows taskbar 
Csharp :: C# Payroll 
Csharp :: convert list of object linq 
Csharp :: object shaking unity 
Csharp :: c# interface implementation 
Csharp :: Write N lines with M numbers each that describe the layout of the second layer in the way shown above 
Csharp :: how to add logo in a unity game apk 
Csharp :: go to the corresponding brace visual studio C# 
Csharp :: .NET TLS 1.3 example 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =