My objective is to Update if Exists or Create the node if it does not.
My code is as follows :
public bool CreateEntity (String sEntityName, String sEntityType, bool bAllowDuplicates) {
if (bAllowDuplicates)
{
var newEntity= new Entity {EntityName=sEntityName, EntityType=sEntityType};
client.Cypher
.Create("(entity:Entity {ParamnewEntity})")
.WithParam("ParamnewEntity",newEntity)
.ExecuteWithoutResults();
}
else
{
var newEntity = new Entity { EntityName = sEntityName, EntityType = sEntityType };
client.Cypher
.Merge("(entity:Entity { EntityName: {entityname} })")
.OnCreate("entity")
.Set("entity = {newEntity}")
.WithParams(new {
entityname = newEntity.EntityName,
newEntity
}
)
.ExecuteWithoutResults();
}
return true;
}
The Class Definition : public class Entity { public string EntityName { get; set;} public string EntityType { get; set;}
}
This code gives an error : CS1501: No overload for method 'OnCreate' takes 1 arguments
What is my mistake ?
BTW is there a place for me to look at the API doc for neo4jclient ?
Im using Neo4jClient.1.0.0.656.
It doesn't look like OnCreate
accepts any parameters. Try just removing the one you're passing.
https://github.com/Readify/Neo4jClient/search?q=OnCreate&ref=cmdform
The wiki is here: https://github.com/Readify/Neo4jClient/wiki