OrientDB-NET.binary icon indicating copy to clipboard operation
OrientDB-NET.binary copied to clipboard

Cannot properly backtick property name with SetField

Open tbertels opened this issue 8 years ago • 1 comments

To use a space, a dash, a question mark or even "batch" in a property name, it needs to be backticked. This works great with myDB.Create.Property, but SetField keeps the backticks and create new properties with backticks in the name.

So while

myDB.Create.Property("`myProperty`", Type.Bool).Class(myClass).Run();

will create a class myClass with a property named myProperty, using after that

aVertex.SetField("`myProperty`", aValue);

will add a property

`myProperty`

and give it a value of aValue and the property myProperty will stay empty.

tbertels avatar Dec 15 '16 14:12 tbertels

To help out with this issue, I'm using the ODocument object and found it working through that object. Hopefully, this is similar to your use case. But I found that even though you have to provide the backticks when creating class property names, when you set a field value that references the generated property name you no longer have to provide the backticks.

Example

// get our connection
ODatabase myDB = new ODatabase(ConnectionOptions)
// adding the new property to our class
myDB.Create.Property("`myProperty`", Type.Bool).Class(myClass).Run();
// you can simply set the property onto your vertex object without the backticks
aVertex.SetField("myProperty", aValue);

jmcdaniel83 avatar Apr 05 '17 20:04 jmcdaniel83