Last active
September 2, 2015 21:29
-
-
Save AzimUddin/4d94baae6c9d299811be to your computer and use it in GitHub Desktop.
An example of querying Master resources in Azure DocumentDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check if database exists, if not create it | |
Database database = client.CreateDatabaseQuery().Where(db => db.Id == id).ToArray().FirstOrDefault(); | |
if (database == null) | |
{ | |
database = await client.CreateDatabaseAsync(new Database { Id = id }); | |
} | |
// Get collection | |
StudentsCollection = client.CreateDocumentCollectionQuery(database.SelfLink).Where(c => c.Id == collectionId).ToArray().FirstOrDefault(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment