Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProgram.cs
More file actions
Latest commit
68 lines (55 loc) · 1.96 KB
/
Copy pathProgram.cs
File metadata and controls
68 lines (55 loc) · 1.96 KB
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
63
64
65
66
67
68
usingOrigoDB.Core;
usingSystem;
namespaceOrigoDb.Examples.GettingStarted
{
classProgram
{
staticvoidMain(string[]args)
{
// Start your engines!
// uses current working directory
Engine<BookmarkModel>engine=Engine.LoadOrCreate<BookmarkModel>();
//create and execute some commands
varcmd=newSaveBookmarkCommand(
"http://google.com/",
"Google",
DateTime.Now,
new[]{"rich","ugly","evil"});
engine.Execute(cmd);
cmd=newSaveBookmarkCommand(
"http://microsoft.com",
"Microsoft",
DateTime.Now,
new[]{"rich","good"}
);
engine.Execute(cmd);
cmd=newSaveBookmarkCommand(
"http://oracle.com",
"Oracle",
DateTime.Now,
new[]{"rich","bad","evil"}
);
engine.Execute(cmd);
//Execute an ad-hoc lambda query
Console.WriteLine("Result of db => db.GetBookmarksByTag(\"evil\")");
varbookmarks=engine.Execute((BookmarkModeldb)=>db.GetBookmarksByTag("evil"));
foreach(varbookmarkinbookmarks)
{
Console.WriteLine(bookmark.Title);
Console.WriteLine(bookmark.Url);
}
Console.WriteLine("---");
//Execute a strongly typed query
Console.WriteLine("Result of GetBookmarksPagedQuery(0,2)");
varquery=newGetBookmarksPagedQuery(0,2);
varpage=engine.Execute(query);
foreach(varbookmarkinpage)
{
Console.WriteLine(bookmark.Title);
Console.WriteLine(bookmark.Url);
}
Console.WriteLine("hit return to terminate");
Console.ReadLine();
}
}
}