Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Commit cd90df2

Browse files
committed
fixed merge conflict
2 parents bd7d1db + 725ae1e commit cd90df2

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Contributions welcome.
99
For those who like to write pure AQL queries for ultimate flexibility. This will mainly focus on AQL string queries at first with convience methods for Insert, Update, Delete etc.
1010

1111
### Managed Foreign Keys
12-
This client supports a managed foreign key feature. This allowa an entity to include a `List<T>` of another entity by setting a data annotation. This will work with two tables in the database but allow users to work the entity as if it was a single document. While this is duplicating some relational database features, this is the most common feature lacking in client libraries.
12+
This client supports a managed foreign key feature. This allows an entity to include a `List<T>` of another entity by setting a data annotation. This will work with two tables in the database but allow users to work the entity as if it was a single document. While this is duplicating some relational database features, this is the most common feature lacking in client libraries.
1313

1414
ArangoDB has an excellent join feature via AQL, and this is the next logical step on the client side. [Please see the documentation for examples](https://github.com/bordereast/arangodb-net-core/wiki)
1515

@@ -27,10 +27,18 @@ GetByKeyAsync | Done | Auto
2727
UpdateAsync | Done | Auto
2828
DeleteAsync | Done | N/A
2929
InsertAsync | Done | Auto
30+
InsertManyAsync | Done | Auto
3031
GetAllAsync | Done | Auto
3132
GetAllKeysAsync | Done | N/A
3233
GetByExampleAsync | Done | Auto
3334
CreateCollection | Done | N/A
3435

3536
### Credits
36-
Based loosely on ideas taken from [ra0o0f](https://github.com/ra0o0f/arangoclient.net) and [yojimbo87](https://github.com/yojimbo87/ArangoDB-NET), this is a .NETCoreApp1.1 library.
37+
Based loosely on ideas taken from [ra0o0f](https://github.com/ra0o0f/arangoclient.net) and [yojimbo87](https://github.com/yojimbo87/ArangoDB-NET), this is a .NETCoreApp2 library.
38+
39+
#### Contributions by
40+
41+
[Irriss](https://github.com/irriss)
42+
43+
[Arkos-LoG](https://github.com/Arkos-LoG)
44+

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/Connection/HttpConnection.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using BorderEast.ArangoDB.Client.Database;
66
using System.Net.Http.Headers;
77
using System.Threading.Tasks;
8+
using BorderEast.ArangoDB.Client.Exception;
89

910
namespace BorderEast.ArangoDB.Client.Connection
1011
{
@@ -59,6 +60,10 @@ public async Task<Result> GetAsync(Payload payload) {
5960
return null;
6061
}
6162

63+
if (!responseTask.IsSuccessStatusCode
64+
&& responseTask.StatusCode != System.Net.HttpStatusCode.BadRequest) //there is detailed info in Content for bad request
65+
throw new QueryExecutionException(responseTask.StatusCode.ToString(), (int)responseTask.StatusCode);
66+
6267
Result result = new Result()
6368
{
6469
StatusCode = responseTask.StatusCode,

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/Database/ArangoQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public async Task<List<T>> ToListAsync() {
8484
var json = JsonConvert.DeserializeObject<AQLResult<T>>(result.Content);
8585

8686
if (json.Error)
87-
throw new QueryExecutionException(json.ErrorMessage);
87+
throw new QueryExecutionException(json.ErrorMessage, json.ErrorNumber);
8888

8989
return json.Result;
9090
}

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/Database/ClientSettings.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ClientSettings() {
2525

2626
public ClientSettings(string serverAddress, int serverPort, ProtocolType protocolType,
2727
string systemPassword, string databaseName, string databaseUsername, string databasePassword,
28-
bool autoCreate, bool isDebug = false, ArangoDBContractResolver arangoDBContractResolver = null)
28+
bool autoCreate, bool isDebug = false, ArangoDBContractResolver arangoDBContractResolver = null) : this()
2929
{
3030
ServerAddress = serverAddress;
3131
ServerPort = serverPort;
@@ -35,14 +35,10 @@ public ClientSettings(string serverAddress, int serverPort, ProtocolType protoco
3535
DatabaseCredential = new NetworkCredential(databaseUsername, databasePassword);
3636
AutoCreate = autoCreate;
3737

38-
if (arangoDBContractResolver == null)
39-
{
40-
arangoDBContractResolver = new ArangoDBContractResolver();
41-
}
4238

4339
JsonSettings = new JsonSerializerSettings
4440
{
45-
ContractResolver = arangoDBContractResolver,
41+
ContractResolver = new ArangoDBContractResolver(),
4642
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
4743
NullValueHandling = NullValueHandling.Include,
4844
DefaultValueHandling = DefaultValueHandling.Include,
@@ -51,7 +47,6 @@ public ClientSettings(string serverAddress, int serverPort, ProtocolType protoco
5147
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
5248
};
5349

54-
5550

5651
IsDebug = isDebug;
5752
}

src/BorderEast.ArangoDB.Client/BorderEast.ArangoDB.Client/Exception/QueryExecutionException.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ namespace BorderEast.ArangoDB.Client.Exception
66
{
77
public class QueryExecutionException : System.Exception
88
{
9-
public QueryExecutionException(string message) : base(message)
9+
public int ErrorNumber { get; private set; }
10+
public QueryExecutionException(string message, int errorNum) : base(message)
1011
{
11-
12+
ErrorNumber = errorNum;
1213
}
1314
}
1415
}

0 commit comments

Comments
 (0)