-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lu_ProjectCode.json
62 lines (49 loc) · 1.58 KB
/
Lu_ProjectCode.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[{
"id" : "30002",
"Name" : "Lokesh",
"class" : "Masters",
"Subject": "DBMS"
}]
[{
"id": "30002",
"Name": "Urvashi",
"class": "Masters",
"Subject": "DBMS",
}]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
using Microsoft.Azure.Documents;
using System.Net;
using Microsoft.Azure.Documents.Client;
namespace ConnectingCosmosDB
{
class JasonData
{
public int id { get; set; }
public string name { get; set; }
public string Class { get; set; }
public string subject { get; set; }
}
class Program
{
static void Main(string[] args)
{
const string EndpointUrl = @"https://lucosmosdemo.documents.azure.com:443/";
const string PrimaryKey = @"88wILG5ApDXMdPhBwGtzmF8CdfouuYl5xk4ahA4IKbAJar5XQI3Ptys5y1h0IxqoiAnzVs4VBK1ayfU0M3qA7A==";
DocumentClient client;
client = new DocumentClient( new Uri(EndpointUrl), PrimaryKey);
FeedOptions queryOptions = new FeedOptions { MaxItemCount = -1 };
IQueryable<JasonData> familyQuery = client.CreateDocumentQuery<JasonData>(
UriFactory.CreateDocumentCollectionUri("lucosmosdemo","ConnectCosmosDBColl"), queryOptions);
foreach (var x in familyQuery)
{
Console.WriteLine("\tDBValues {0}", x.id + " " + x.name + " " + x.Class + " " + x.subject);
}
Console.Read();
}
}
}