How to use return * in neo4jclient

174 Views Asked by At

Can anybody help me to convert this cypher query into neo4jclient

MATCH (a)-[r]-(p:Post) RETURN * 

Here what I have done so far

Match("(a)-[r]-(p:Post)").Return<object>(*);

but will return an error saying : Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied

1

There are 1 best solutions below

1
On BEST ANSWER

Return<T> requires you a type, so that Neo4jClient knows how to deserialize the response into objects. It can't take a pile of different node shapes and jam them into instances of object, so hence it failing.

You'll need to do something like:

Return((a, p) => new
{
    Author = a.As<Author>(),
    Post = p.As<Post>()
})

Remember, C# is a statically type language.