The following lines declare the code for the RetrieveOrCreateDatabaseAsync asynchronous static method, which creates a new document database in the Cosmos DB account if a database with Id equal to the value stored in the databaseId field doesn't exist. Add the following lines to the existing code of the Program.cs file. The code file for the sample is included in the learning_cosmos_db_04_01 folder in the dot_net_core_2_samples/SampleApp1/SampleApp1/Program.cs file:
private static async Task<Database> RetrieveOrCreateDatabaseAsync() { // Create a new document database if it doesn't exist var databaseResponse = await client.CreateDatabaseIfNotExistsAsync( new Database { Id = databaseId, }); switch (databaseResponse.StatusCode) { case System.Net.HttpStatusCode...