.NET SDK for Azure Cosmos DB for the core SQL API
Перейти к файлу
Debdatta Kunda 7839885dde
ClientRetryPolicy: Adds Cross Regional Retry Logic on 429/3092 (#4691)
* Initial code changes to throw 503 on 429/3092.

* Updated client retry policy. Added more tests to cover 429/3092.

* Code changes to update direct package version. Updating the tests.

* Code changes to refactor client retry policy.

* Minor code cleanup.

* Reverting the direct version bump up change.

* Code changes to address some of the review comments.

* Code changes to move failover logic in client retry policy.

* Minor code clean up.

* Code changes to clean up some cosmetic items.

* Further clean up.

* Code changes to address review comments.

* Minor refactor to address cosmetic update.

* Code changes to address cosmetic review comment.
2024-09-17 18:17:30 +00:00
.github
Microsoft.Azure.Cosmos ClientRetryPolicy: Adds Cross Regional Retry Logic on 429/3092 (#4691) 2024-09-17 18:17:30 +00:00
Microsoft.Azure.Cosmos.Encryption
Microsoft.Azure.Cosmos.Encryption.Custom
Microsoft.Azure.Cosmos.Samples
docs
templates
.editorconfig
.gitattribute
.gitignore
.sscignore
35MSSharedLib1024.snk
CODEOWNERS Adding Kevin and removing Kirill from code owners (#4689) 2024-09-16 09:47:06 -07:00
CONTRIBUTING.md
CredScanSuppressions.json
Directory.Build.props Bump up the cosmos.direct package version. (#4687) 2024-09-13 17:52:34 +00:00
Exceptions.md
LICENSE
Microsoft.Azure.Cosmos.sln
PULL_REQUEST_TEMPLATE.md
README.md
SECURITY.md
SdkDesignGuidelines.md
ThirdPartyNotice.txt
UpdateContracts.ps1
UpdateDotNetVersion.ps1
azure-pipelines-cron.yml
azure-pipelines-ctl-publishing.yml
azure-pipelines-encryption-custom.yml
azure-pipelines-encryption.yml
azure-pipelines-functional.yml
azure-pipelines-nightly.yml
azure-pipelines-official.yml
azure-pipelines-rolling.yml
azure-pipelines.yml
changelog.md SDK 3.43.0: Adds version bump and changelog (#4666) 2024-09-04 20:08:59 +00:00
repo.config
testkey.snk

README.md

NuGet NuGet Prerelease

Microsoft Azure Cosmos DB .NET SDK Version 3

This client library enables client applications to connect to Azure Cosmos DB for NoSQL. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to https://azure.microsoft.com/services/cosmos-db/.

CosmosClient client = new CosmosClient("https://mycosmosaccount.documents.azure.com:443/", "mysupersecretkey");
Database database = await client.CreateDatabaseIfNotExistsAsync("MyDatabaseName");
Container container = await database.CreateContainerIfNotExistsAsync(
    "MyContainerName",
    "/partitionKeyPath",
    400);

// Create an item
dynamic testItem = new { id = "MyTestItemId", partitionKeyPath = "MyTestPkValue", details = "it's working", status = "done" };
ItemResponse<dynamic> createResponse = await container.CreateItemAsync(testItem);

// Query for an item
using (FeedIterator<dynamic> feedIterator = container.GetItemQueryIterator<dynamic>(
    "select * from T where T.status = 'done'"))
{
    while (feedIterator.HasMoreResults)
    {
        FeedResponse<dynamic> response = await feedIterator.ReadNextAsync();
        foreach (var item in response)
        {
            Console.WriteLine(item);
        }
    }
}

Install via Nuget.org

Install-Package Microsoft.Azure.Cosmos

For available versions, see SDK versioning.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Resources:

Contributing

For details on contributing to this repository, see the contributing guide.

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.