Calling asynchronous methods that use POCOs to create and query documents

Now we will write the code for the CreateAndQueryCompetitionsWithLinqAsync asynchronous static method, which calls the previously created and explained asynchronous static methods. 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_05_01 folder in the SampleApp2/SampleApp1/Program.cs file:

private static async Task CreateAndQueryCompetitionsWithLinqAsync() { var database = await RetrieveOrCreateDatabaseAsync(); Console.WriteLine( $"The database {databaseId} is available for operations with the following AltLink: {database.AltLink}"); var collection = await CreateCollectionIfNotExistsAsync(); ...

Get Guide to NoSQL with Azure Cosmos DB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.