O'Reilly logo

Guide to NoSQL with Azure Cosmos DB by Daron Yondem, Gaston C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required