Soenneker.Cosmos.Database.Setup
4.0.2347
Prefix Reserved
dotnet add package Soenneker.Cosmos.Database.Setup --version 4.0.2347
NuGet\Install-Package Soenneker.Cosmos.Database.Setup -Version 4.0.2347
<PackageReference Include="Soenneker.Cosmos.Database.Setup" Version="4.0.2347" />
<PackageVersion Include="Soenneker.Cosmos.Database.Setup" Version="4.0.2347" />
<PackageReference Include="Soenneker.Cosmos.Database.Setup" />
paket add Soenneker.Cosmos.Database.Setup --version 4.0.2347
#r "nuget: Soenneker.Cosmos.Database.Setup, 4.0.2347"
#:package Soenneker.Cosmos.Database.Setup@4.0.2347
#addin nuget:?package=Soenneker.Cosmos.Database.Setup&version=4.0.2347
#tool nuget:?package=Soenneker.Cosmos.Database.Setup&version=4.0.2347
Soenneker.Cosmos.Database.Setup
Creates an Azure Cosmos DB database when it does not exist and optionally updates its shared throughput.
Installation
dotnet add package Soenneker.Cosmos.Database.Setup
Configuration
{
"Azure": {
"Cosmos": {
"Endpoint": "https://your-account.documents.azure.com:443/",
"AccountKey": "your-account-key",
"DatabaseName": "app",
"DatabaseThroughput": 1000,
"DatabaseThroughputType": "autoscale",
"ReplaceDatabaseThroughput": false
}
}
}
DatabaseThroughputType is case-insensitive. The value autoscale creates autoscale throughput; every other value selects manual throughput. DatabaseThroughput and DatabaseThroughputType are required for both Ensure overloads because throughput is read from configuration.
When ReplaceDatabaseThroughput is false or omitted, throughput is supplied only if the database must be created. When it is true, the configured throughput is also applied to an existing database after it is resolved.
Registration and use
using Soenneker.Cosmos.Database.Setup.Abstract;
using Soenneker.Cosmos.Database.Setup.Registrars;
services.AddCosmosDatabaseSetupUtilAsSingleton();
ICosmosDatabaseSetupUtil setup = serviceProvider.GetRequiredService<ICosmosDatabaseSetupUtil>();
Microsoft.Azure.Cosmos.Database database = await setup.Ensure(cancellationToken);
Ensure() reads the endpoint, account key, and database name from Azure:Cosmos. To provide those values per call:
Microsoft.Azure.Cosmos.Database database = await setup.Ensure(
endpoint,
accountKey,
"app",
cancellationToken);
AddCosmosDatabaseSetupUtilAsScoped() is also available. Both registrations add the Cosmos client utility as a singleton.
Transient request timeouts, throttling, HTTP failures, and selected Cosmos service errors are retried five times with exponential backoff and jitter. Authentication, authorization, invalid configuration, exhausted retries, throughput replacement failures, and cancellation propagate to the caller.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Kevlar (>= 1.1.0)
- Soenneker.Cosmos.Client (>= 4.0.3716)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Cosmos.Database.Setup:
| Package | Downloads |
|---|---|
|
Soenneker.Cosmos.Database
A utility library for storing Azure Cosmos databases |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2347 | 52 | 9/9/2026 |
| 4.0.2346 | 63 | 9/9/2026 |
| 4.0.2345 | 103 | 9/9/2026 |
| 4.0.2344 | 141 | 9/8/2026 |
| 4.0.2343 | 245 | 9/8/2026 |
| 4.0.2342 | 78 | 9/8/2026 |
| 4.0.2341 | 71 | 9/8/2026 |
| 4.0.2340 | 73 | 9/8/2026 |
| 4.0.2339 | 206 | 9/7/2026 |
| 4.0.2338 | 289 | 9/7/2026 |
| 4.0.2337 | 446 | 9/5/2026 |
| 4.0.2336 | 137 | 9/5/2026 |
| 4.0.2335 | 329 | 9/4/2026 |
| 4.0.2334 | 181 | 9/4/2026 |
| 4.0.2333 | 92 | 9/4/2026 |
| 4.0.2332 | 257 | 9/4/2026 |
| 4.0.2331 | 262 | 9/4/2026 |
| 4.0.2330 | 82 | 9/4/2026 |
| 4.0.2329 | 102 | 9/4/2026 |
| 4.0.2328 | 178 | 9/4/2026 |
Updated Multiple NuGet packages