0

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...

1 Answers1

3

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.

Community
  • 1
  • 1
Tatham Oddie
  • 4,290
  • 19
  • 31
  • its return 8 items it contains null http://i019.radikal.ru/1401/4c/e910d80285c6.png – Sevkavru Sevkavru Jan 23 '14 at 07:39
  • its return me true count of items, but in treeview i view null data – Sevkavru Sevkavru Jan 23 '14 at 08:08
  • The `null` responses are because the returned objects can't be deserialized back into your `treeview` objects. Try changing your `private` modifiers for the properties (i.e. `private string Name {get;set;}`) to public: `public string Name { get;set;}`. – Charlotte Skardon Jan 23 '14 at 15:26
  • @SevkavruSevkavru - please don't post your updates/clarifications as comments to this answer. Rather, edit your original question with the additional information. – David Makogon Jan 23 '14 at 15:50