-
-
Notifications
You must be signed in to change notification settings - Fork 138
/
Poco.cs
45 lines (38 loc) · 1.09 KB
/
Poco.cs
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
using Newtonsoft.Json.Linq;
using RethinkDb.Driver.Net;
using RethinkDb.Driver.Proto;
namespace RethinkDb.Driver.Ast
{
internal class Poco : ReqlExpr
{
private readonly object obj;
public Poco(object obj) : base(new TermType(), null, null)
{
this.obj = obj;
}
internal class PocoWriter : JTokenWriter
{
public override void WriteStartArray()
{
base.WriteStartArray();
this.WriteValue(Proto.TermType.MAKE_ARRAY);
base.WriteStartArray();
}
public override void WriteEndArray()
{
base.WriteEndArray();
base.WriteEndArray();
}
}
protected internal override object Build()
{
JToken token;
using( var writer = new PocoWriter() )
{
Converter.Serializer.Serialize(writer, this.obj);
token = writer.Token;
}
return token;
}
}
}