Comments (3)
@drgraduss i found a bug in resolving _to
identifier and publish new nuget packages (please first upgrade https://www.nuget.org/packages/ArangoDB.Client). but i'm afraid i didn't understand the exact problem you have:
you can insert an edge with document
object itself, there is no need for JObject
object, an example would be:
public class Person
{
[DocumentProperty(Identifier= IdentifierType.Key)]
public string Key { get; set; }
public string Fullname { get; set; }
}
public class Friend
{
[DocumentProperty(Identifier = IdentifierType.EdgeFrom)]
public string From { get; set; }
[DocumentProperty(Identifier = IdentifierType.EdgeTo)]
public string To { get; set; }
public string Message { get; set; }
}
var p1 = new Person { Fullname = "raoof" };
var p2 = new Person { Fullname = "drgraduss" };
db.Insert<Person>(p1);
db.Insert<Person>(p2);
var friend = new Friend { Message = "lets be friends" };
db.InsertEdge<Friend, Person, Person>(p1.Key, p2.Key, friend);
Debug.Assert(p1.Key != null);
Debug.Assert(p2.Key != null);
Debug.Assert(friend.From != null);
Debug.Assert(friend.To != null);
if you insist using the JObject, client does not allow this yet, let me know if you need it to add support for it.
if your problem is something else please provide an example with a failing test
from arangoclient.net.
Hi @ra0o0f. Thanks for quick reply. I was using edge document to create an edge and not a JObject.
JObject snippet is from your code base which is part of InsertEdgeAsync method.
graph.InsertEdge<EdgeDocument, VerticeDocument, VerticeDocument>("_from", "_to", new EdgeDocument);
I haven't specified DocumentProperty
attributes on Edge document and used plain object.
It would be good to see some documentation as it's not obvious how to map Arango's _key, _from, _to, _rev
properties and if they're required to be present in the document.
from arangoclient.net.
you can also specify document properties mappings with DatabaseSharedSetting
// change settings for collections
sharedSetting.Collection.ChangeCollectionPropertyForType<Product>(p =>
{
p.CollectionName = "products";
p.Naming = NamingConvention.ToCamelCase;
});
// change default Idetntifier for `_key` property for all types
sharedSetting.Collection.ChangeIdentifierDefaultName(IdentifierType.Key, "Key");
// change default Idetntifier for `_key` property for specific type
sharedSetting.Collection.ChangeDocumentPropertyForType<Product>(p => p.productKey, s => {
{
s.Identifier = IdentifierType.Key;
}});
shared settings full example at DatabaseSetup
from arangoclient.net.
Related Issues (20)
- ArangoServerException not throw when db unavailable HOT 2
- Thread safety HOT 7
- Confused with SystemDatabaseCredential HOT 5
- Custom Index HOT 6
- ByExampleAsync missing HOT 2
- Make ChangeCollectionPropertyForType public HOT 1
- Using LINQ query with Where performance HOT 1
- Error in generated AQL when upserting a generic document HOT 7
- ArangoServerException eats up all the useful information like status code and error number HOT 2
- Make collection name resolver more extensible HOT 2
- Annotating a property of type Guid as DocumentProperty.Key throws InvalidCastException HOT 2
- Support private setter
- CreateStatement<object> & Remove Vertex HOT 1
- Ternary operator support
- Global error handling policy
- Support for keyOptions: uuid
- Edge Document API not supported?
- Cannot Simply Connect to Server...... HOT 2
- Secure connection to ArangoDB
- Query directly within a collection
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arangoclient.net.