Cuir in eagar

Comhroinn trí


Examples for Azure Cosmos DB for NoSQL SDK for .NET

APPLIES TO: NoSQL

The cosmos-db-nosql-dotnet-samples GitHub repository includes multiple sample projects. These projects illustrate how to perform common operations on Azure Cosmos DB for NoSQL resources.

Prerequisites

Samples

The sample projects are all self-contained and are designed to be ran individually without any dependencies between projects.

Client

Task API reference
Create a client with endpoint and key CosmosClient(string, string)
Create a client with connection string CosmosClient(string)
Create a client with DefaultAzureCredential CosmosClient(string, TokenCredential)
Create a client with custom TokenCredential CosmosClient(string, TokenCredential)

Databases

Task API reference
Create a database CosmosClient.CreateDatabaseIfNotExistsAsync

Containers

Task API reference
Create a container Database.CreateContainerIfNotExistsAsync

Items

Task API reference
Create an item Container.CreateItemAsync<>
Point read an item Container.ReadItemAsync<>
Query multiple items Container.GetItemQueryIterator<>

Next steps

Dive deeper into the SDK to import more data, perform complex queries, and manage your Azure Cosmos DB for NoSQL resources.