Snippets | Azure Cosmos DB

Crear una base de datos Azure Cosmos DB

Database database = client.CreateDatabaseQuery().Where(db => db.Id == databaseId).AsEnumerable().FirstOrDefault();
Console.WriteLine("1. Query for a database returned: {0}", database==null?"no results":database.Id);

if (database==null)
{
     database = await client.CreateDatabaseAsync(new Database { Id = databaseId });
     Console.WriteLine("\n2. Created Database: id - {0} and selfLink - {1}", database.Id, database.SelfLink);
}

 

También te podría gustar...