Examples for Azure Cosmos DB SQL API SDK for .NET
APPLIES TO:
SQL API
The cosmos-db-sql-api-dotnet-samples GitHub repository includes multiple sample projects. These projects illustrate how to perform common operations on Azure Cosmos DB SQL API resources.
Prerequisites
- An Azure account with an active subscription. Without a credit card or an Azure subscription, you can set up a free Try Azure Cosmos DB account.
- Azure Cosmos DB SQL API account. Create a SQL API account.
- .NET 6.0 or later
- Azure Command-Line Interface (CLI) or Azure PowerShell
Samples
The sample projects are all self-contained and are designed to be ran individually without any dependencies between projects.
Client
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 SQL API resources.
Povratne informacije
Pošalјite i prikažite povratne informacije za