You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I am trying to do is use OrientDB-NET.binary package within C# to create a graph. The documentation is a little light but from what I can tell, vertices are added via the transaction object with the method Add. I'm assuming this means that I can add vertex from a custom class (although this class seems to need to be derived from the IBaseRecord interface). So I created an example class like this:
public class MyClass : IBaseRecord
{
private string _className = nameof(MyClass);
private short _classId = 1;
private int _version = 1;
public string Name { get; set; }
public int OVersion { get => _version; set => _version = value; }
public short OClassId { get => _classId; set => _classId = value; }
public string OClassName { get => _className ; set => _className = value ; }
}
I connect to the database and then try and call code along the lines of
var a = new MyClass { Name = "A" };
database.Transaction.Add<MyClass>(a);
database.Transaction.Commit();
But this doesn't work as the Add throws an exception with the message "Object reference not set to an instance of an object". What's wrong with this?
(For the record, the opposite works fine with Query which populates the class properties fine.)
The text was updated successfully, but these errors were encountered:
Try doing like this it worked for me and my friend @RaffaeleMays var a = new MyClass { Name = "A" }; database.DatabaseProperties.ORID = new ORID(); database.Transaction.Add<MyClass>(a); database.Transaction.Commit();
I am new to OrientDB but not to graph structures.
What I am trying to do is use OrientDB-NET.binary package within C# to create a graph. The documentation is a little light but from what I can tell, vertices are added via the transaction object with the method Add. I'm assuming this means that I can add vertex from a custom class (although this class seems to need to be derived from the IBaseRecord interface). So I created an example class like this:
I connect to the database and then try and call code along the lines of
But this doesn't work as the Add throws an exception with the message "Object reference not set to an instance of an object". What's wrong with this?
(For the record, the opposite works fine with Query which populates the class properties fine.)
The text was updated successfully, but these errors were encountered: