-
Notifications
You must be signed in to change notification settings - Fork 145
/
BoltGraphClient.cs
46 lines (40 loc) · 1.56 KB
/
BoltGraphClient.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
46
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Neo4jClient.Execution;
using Neo4jClient.Serialization;
using Neo4jClient.Transactions;
using Newtonsoft.Json;
//TODO: Logging
//TODO: Config Stuff
//TODO: Transaction Stuff
namespace Neo4jClient
{
public partial class BoltGraphClient : IBoltGraphClient, IRawGraphClient, ITransactionalGraphClient
{
public BoltGraphClient(Uri uri, string username = null, string password = null, string realm = null)
{
if ((uri.Scheme == "http") || (uri.Scheme == "https"))
throw new NotSupportedException($"To use the {nameof(BoltGraphClient)} you need to provide a 'bolt://' scheme, not '{uri.Scheme}'.");
this.uri = uri;
this.username = username;
this.password = password;
this.realm = realm;
PolicyFactory = new ExecutionPolicyFactory(this);
JsonConverters = new List<JsonConverter>();
JsonConverters.AddRange(DefaultJsonConverters);
JsonContractResolver = DefaultJsonContractResolver;
ExecutionConfiguration = new ExecutionConfiguration
{
UserAgent = $"Neo4jClient/{GetType().GetTypeInfo().Assembly.GetName().Version}",
UseJsonStreaming = true,
JsonConverters = JsonConverters,
Username = username,
Password = password,
Realm = realm
};
transactionManager = new BoltTransactionManager(this);
}
}
}