Retrieving a POCO with a LINQ asynchronous query
Now open the Program.cs file and add the following using statements after the last line that declares a using statement: using System.Threading.Tasks;. The code file for the sample is included in the learning_cosmos_db_06_01 folder in the SampleApp1/SampleApp1/Program.cs file:
using System.Collections.Generic; using SampleApp1.Models; using SampleApp1.Types;
Add the following static field to the Program class after the code that declares the client static field: private static DocumentClient client;. In this new version, we will save the Uri instance for the document collection in this field to reuse it in all the methods that require the collection URI:
private static Uri collectionUri;
Â
Â
The following lines declare the code for the GetCompetitionByTitleWithLinq asynchronous static method that builds a LINQ query to retrieve a Competition instance with a specific title from the document collection. The code is the LINQ version of the existing...