Skip to content

Instantly share code, notes, and snippets.

@dstarr
Created March 6, 2018 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstarr/f91e7a919f78ae1ad5c33e9ce86686f7 to your computer and use it in GitHub Desktop.
Save dstarr/f91e7a919f78ae1ad5c33e9ce86686f7 to your computer and use it in GitHub Desktop.
Provision Azure Cosmos DB if needed
private async Task ProvisionDbIfNeeded()
{
await client.CreateDatabaseIfNotExistsAsync(new Database { Id = dbName });
await client.CreateDocumentCollectionIfNotExistsAsync(
UriFactory.CreateDatabaseUri(dbName),
new DocumentCollection { Id = collectionName }
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment