Skip to content

Commit fb01b61

Browse files
committed
Update README.md
1 parent f283d52 commit fb01b61

File tree

1 file changed

+2
-138
lines changed

1 file changed

+2
-138
lines changed

README.md

+2-138
Original file line numberDiff line numberDiff line change
@@ -1,152 +1,16 @@
11
### .Net client driver for http://www.arangodb.net
22
##### written in c# portable class library[.net 4.5, winphone 8.1]
33

4-
nuget package https://www.nuget.org/packages/ArangoDB.Client
4+
Project website: http://www.arangoclient.net
55

66
<hr/>
77

88
### Main features
99
* Linq to Aql
1010
* Asynchronous and Synchronous API
1111
* Stream data with IEnumerable or IAsyncEnumerator
12-
* Change Tracking (Under development will be available soon)
12+
* Change Tracking
1313

1414
note:
1515
linq-provider now supports several functions ( orderby,take,skip,groupby,join... with aql synonyms sort,filter,collect,for,limit... )
16-
. all api operations performs async internally with sync-over-async api.
1716
<br/><b>all APIs will be added soon(with documentation), but don't hesitate to open an issue if you need one sooner</b>
18-
19-
### Quick sample
20-
```csharp
21-
class Person
22-
{
23-
[DocumentProperty(Identifier = IdentifierType.Key)]
24-
public string Key;
25-
26-
public string Name;
27-
28-
public int Age;
29-
}
30-
31-
using (ArangoDatabase db = new ArangoDatabase(url: "http://localhost:8529", database: "SampleDB"))
32-
{
33-
var person = new Person { Name = "raoof hojat", Age = 27 };
34-
35-
// saves new document and creates 'Person' collection on the fly
36-
db.Save<Person>(person);
37-
// perform operation async
38-
await db.SaveAsync<Person>(person);
39-
40-
// returns [27]
41-
var persons = db.Query<Person>()
42-
.Filter(p => AQL.Contains(x.Name, "raoof"))
43-
.Return(p => p.Age)
44-
.ToList();
45-
}
46-
```
47-
<hr/>
48-
49-
###Linq Samples
50-
```c#
51-
// join sample
52-
var query = from p in db.Query<Person>()
53-
from o in db.Query<Order>()
54-
where p.Key == o.CustomerKey
55-
select new { p.Name,o.Title };
56-
57-
```
58-
```c#
59-
// lambda sample
60-
var query = db.Query<Order>()
61-
.Where(x=>x.Price<10000)
62-
.Skip(500)
63-
.Take(100)
64-
.GroupBy(x => x.CustomerKey)
65-
.Select(x => new
66-
{
67-
Key = x.Key
68-
});
69-
70-
// aql clauses equivalent
71-
var query = db.Query<Order>()
72-
.Filter(x => x.Price < 10000)
73-
.Limit(500, 100)
74-
.Collect(x => x.CustomerKey)
75-
.Return(x => new
76-
{
77-
Key = x.Key
78-
});
79-
80-
// aql query equivalent
81-
var query = db.CreateStatement<Order>(@"for x in Order
82-
filter x.Price < 10000
83-
limit 500,100
84-
collect CustomerKey = x.CustomerKey into C1
85-
return { CustomerKey }
86-
");
87-
```
88-
<hr/>
89-
90-
### Streaming data
91-
92-
```c#
93-
var cursor = db.ByExample<Person>(new {Age=20});
94-
95-
// fetch cursor result
96-
var list = cursor.ToList();
97-
98-
// stream cursor results
99-
foreach(var p in cursor.AsEnumerable())
100-
Console.WriteLine(p.Name);
101-
102-
// fetch cursor result async
103-
var list = awiat cursor.ToListAsync();
104-
105-
// stream cursor results async
106-
using(enumerator = cursor.GetAsyncEnumerator())
107-
{
108-
while(await enumerator.MoveNextAsync())
109-
{
110-
Console.WriteLine(enumerator.Current.Name);
111-
}
112-
}
113-
```
114-
115-
<hr/>
116-
117-
### Database Settings
118-
119-
client behavior could be change by 'db.Settings' property, like:
120-
121-
```c#
122-
// will set default value for waitForSync to true anywhere it is used
123-
db.Settings.WaitForSync = true;
124-
125-
// waitForSync is true
126-
db.Update<Person>("41234512",new {Name:"hojat"});
127-
128-
// waitForSync will be overridden to false
129-
db.Update<Person>("41234512",new {Name:"hojat"}, waitForSync: false);
130-
```
131-
132-
for ease of changing client behavior, ArangoDatabase could be create with following static methods
133-
134-
```c#
135-
// set setting once
136-
var setting = ArangoDatabase.FindSetting();
137-
setting.WaitForSync = true;
138-
139-
// will create ArangoDatabase with setting defined above
140-
using(ArangoDatabase db = ArangoDatabase.WithSetting())
141-
{
142-
}
143-
144-
// you can define multiple settings by passing an identifier to "FindSetting"
145-
var setting = ArangoDatabase.FindSetting("SampleDbSetting");
146-
setting.WaitForSync = true;
147-
148-
// and use it like this
149-
using(ArangoDatabase db =ArangoDatabase.WithSetting("SampleDbSetting"))
150-
{
151-
}
152-
```

0 commit comments

Comments
 (0)