Question

I have this query

 MATCH (root:Lvl1)-[:HAVE_OTDEL|HAVE_GROUP*0..]->(leaf)  RETURN DISTINCT leaf;

 CypherQuery query =
                new CypherQuery(
                    string.Format("MATCH (root:Lvl1)-[:HAVE_OTDEL|HAVE_GROUP*0..]->(leaf)  RETURN DISTINCT leaf;"), new Dictionary<string, object>(), CypherResultMode.Set);
            var persons = ((IRawGraphClient) client).ExecuteGetCypherResults<treeview>(query).ToList();

treeview.cs

  class treeview
    {
        private string Name { get; set; }
        private string lvl { get; set; }
    }

This return me error Serialization...

Was it helpful?

Solution

Please do not use ExecuteGetCypherResults. The documentation tells you not to use it. I have told you not to use it (Convert cypher query to c#). You do not need to use it. Please, please do not use it. I don't know where you found it, but that documentation is obviously wrong.

Now, the correct translation of your query to C# is:

client.Cypher
    .Match("(root:Lvl1)-[:HAVE_OTDEL|HAVE_GROUP*0..]->(leaf)")
    .ReturnDistinct(leaf => leaf.As<treeview>())
    .Results

If that doesn't work for you, then you need to give us more information. You said "return me error" but then you never listed that error. Why didn't you post it? That's probably the one piece of information that would let us help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top