I want to create relationship between nodes with parameter as an object like -
await _graphClient.ConnectAsync();
await _graphClient.Cypher
.Match("(obj1:Client)")
.Where((Client obj1) => obj1.ClientId == UserId)
.Match("(obj2:Job)")
.Where((Job obj2) => obj2.Id == JobId)
.CreateUnique("(obj1)-[r:JOB_POSTED $relationobj1]->(obj2)")
.WithParam("relationobj1", relationobj1)
.ExecuteWithoutResultsAsync();
Above code is giving error -
{"Invalid input 'UNIQUE': expected "(", "allShortestPaths" or "shortestPath" (line 5, column 8 (offset: 109))\n"CREATE UNIQUE (obj1)-[r:JOBS_POSTED $relationobj1]->(obj2)"\n ^"}
I tried MERGE as well instead of CreateUnique.
but still it didnt work.
Error with MERGE -
{"Parameter maps cannot be used in MERGE patterns (use a literal map instead, eg. "{id: {param}.id}") (line 5, column 29 (offset: 130))\n"MERGE (obj1)-[r:JOB_POSTED $relationobj1]->(obj2)"\n ^"}
If I remove $relationobj1 from relation param, its working.
Object relationobj1 is generated like this -
JOBS_POSTED relationobj1 = new JOBS_POSTED();
relationobj1.createddate = DateTime.UtcNow;
Any idea on whats the correct way to pass parameter as an object to relationship?
Thanks in advance!