public async Task Initialize(CosmosEnvironment cosmosEnvironment) { await TruncateEnvironment(); foreach (var database in cosmosEnvironment.Databases) { await CreateDatabase(database.Name, database.RequestOptions); foreach (var collection in database.Collections) { await CreateCollection(database.Name, collection.Name, collection.RequestOptions); } } }
private async Task InitializeDatabase() { var env = new CosmosEnvironment { Databases = new List <CosmosDatabase> { new CosmosDatabase { Name = "Library", Collections = new List <CosmosCollection> { new CosmosCollection { Name = "Books", RequestOptions = new RequestOptions { OfferThroughput = InitialThroughput } }, new CosmosCollection { Name = "Comics", RequestOptions = new RequestOptions { OfferThroughput = InitialThroughput } } } }, new CosmosDatabase { Name = "Videoclub", Collections = new List <CosmosCollection> { new CosmosCollection { Name = "Movies" }, new CosmosCollection { Name = "TV Shows" } }, RequestOptions = new RequestOptions { OfferThroughput = InitialThroughput } } } }; await _databaseHelper.Initialize(env); }