Without knowing your complete query or particular problem/scenario you are trying to address, it is difficult to suggest a complete query but a chained return method containing something like the following might work?
var query = client.Cypher
.Match("p = [your match statement]")
.Return(p => new
{
StartNodes = Return.As<IEnumerable<Node<Person>>>("extract(ri in rels(p) | startnode(ri))"),
Relations = Return.As<IEnumerable<RelationshipInstance<Person>>>("extract(ri in rels(p) | ri)"),
EndNodes = Return.As<IEnumerable<Node<Person>>>("extract(ri in rels(p) | endnode(ri))")
});
If you don't need the wrapper objects you could simply return IEnumerable<Person>
, e,g,
.Return(p => new
{
StartNodes = Return.As<IEnumerable<Person>>("extract(ri in rels(p) | startnode(ri))"),
Relations = Return.As<IEnumerable<Person>>("extract(ri in rels(p) | ri)"),
EndNodes = Return.As<IEnumerable<Person>>("extract(ri in rels(p) | endnode(ri))")
});
Note that the above code assumes that your are trying to deserialize the response from Neo4j into a POCO object of type Person
. You should substitute this for whatever object that you are using.