public GetRepository(IDocumentClient client, string databaseId, string collectionId) { DatabaseId = databaseId; CollectionId = collectionId; this.client = client; client.CreateCollectionIfNotExistsAsync(databaseId, collectionId).Wait(); }
/// <summary> /// Creates the database and collection if it does not exist. /// </summary> /// <param name="documentClient">The document client.</param> /// <param name="databaseId">The id of the database.</param> /// <param name="collectionId">The id of the collection.</param> public static void CreateCollectionIfDoesNotExist(this IDocumentClient documentClient, string databaseId, string collectionId) { documentClient.CreateDatabaseIfNotExistsAsync(databaseId).Wait(); documentClient.CreateCollectionIfNotExistsAsync(databaseId, collectionId).Wait(); }