Skip to content

ephemerally.azure.cosmos

Colton Fussy edited this page Jun 21, 2024 · 3 revisions

Cosmos DB

dotnet add package Ephemerally.Azure.Cosmos

Database

// Create a new ephemeral database with a random name
await using var randomDatabase = cosmosClient.CreateEphemeralDatabaseAsync();
// Make an existing database ephemeral
Database existingDatabase = cosmosClient.GetDatabase("myCoolDatabase");
await using var ephemeralExistingDatabase.ToEphemeral();

Container

// Create a new ephemeral container with a random name
await using var randomContainer = cosmosDatabase.CreateEphemeralContainerAsync();
// Make an existing container ephemeral
Container existingContainer = cosmosDatabase.GetContainer("myCoolContainer");
await using var ephemeralExistingContainer.ToEphemeral();
Clone this wiki locally