Configuring a Cosmos DB client
Now we will write the code for the main method of our console application that will retrieve the necessary values from the previously coded JSON configuration file to configure an instance of the Microsoft.Azure.Documents.Client.DocumentClient
class, which will allow us to write additional code that will perform requests to the Azure Cosmos DB service. We will be writing methods that perform additional tasks later, and we will use many code snippets to understand each task. We will analyze many of the possible ways of performing tasks with the Cosmos DB SDK.
Replace the code of the Program.cs
file with the following contents, which declare the necessary using
statements, the first lines of the new Program
class, and the Main
static method. 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:
namespace SampleApp1 { using Microsoft.Azure.Documents; using Microsoft...