Retrieving a document with an asynchronous query
The following lines declare the code for the GetCompetitionByTitle
asynchronous static method, which builds a query to retrieve a competition with a specific title from the document collection. The code takes advantage of the possibilities offered by the SDK to limit the number of results returned by the query and execute the query with an asynchronous execution. The code adds complexity to work with an asynchronous execution. We don't want to run a query with a synchronous execution in our examples. 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<dynamic> GetCompetitionByTitle(string competitionTitle) { // Build a query to retrieve a document with a specific title var collectionUri = UriFactory.CreateDocumentCollectionUri(databaseId...