예제 #1
0
 private async Task CreateDatabaseIfNotExistsAsync()
 {
     try
     {
         await DatabaseClient.ReadDatabaseAsync(
             UriFactory.CreateDatabaseUri(Config.Instance.DocumentDbDatabaseId));
     }
     catch (DocumentClientException e)
     {
         if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
         {
             await DatabaseClient.CreateDatabaseAsync(new Database { Id = Config.Instance.DocumentDbDatabaseId });
         }
         else
         {
             throw;
         }
     }
 }