c# - Casting nodes of an unknown type -


Using Neo4j I am able to create an array of nodes with labels and then create relationships between those nodes I am able to Labels are essentially mapping to my POCOs (a dog is related to a dog POCO in C #) and these POCOs implement with a simple base POCO that has only one ID property.

When I type / label the node to retrieve, I'm able to use it node. Like & lt; T within the return statement> Syntax However, when doing things like crossing the path between the nodes, I do not know the type of node that I am tracing. Although it is technically possible to put the node in the form of a base, which implement with my POCOs, I lose all the properties that are specific to the superclass.

Any ideas about how to get started on this?

graph

You can (depending on how you feel about it) Try to use dynamic, for example, you can set it this way Can:

  var dog = new dog {name = "woofer", breed = "Afghan hound"}; Var boss = new person {name = "jeff", phone number = "01234567890"}; // Create gc.Cypher ("Owner: person {owner prames})"). Parmesan ("owner prames", owner). ("Owner"). ("(Owner) - .: [: HAS_PET] - & gt; (dog: dog {dogParams}})". .murm ("dogperm", dog). Exit With Results ();  

and retrieve it with:

  // Return query query = GC Seafarer .Match ("(p: person) - [: HAS_PET] - & gt; (D: dog)"). Returns ((P, D) => New {person = P. AS  string> gt;>, dog = das  string & gt; ; & Gt; ()}); Var result = query.Results.ToList (); Foreign results (results in result) (dynamic p = JsonConvert.DeserializeObject & lt; dynamic & gt; (result masters data); dynamic D = JsonConvert.DeserializeObject & gt; dynamic & gt; (result.Dog.Data); Console.light line ("if you find {0} (one {1}), call {3} on {2}", d.Name, d.breed, p.Name, p.phoneNumber);} Obviously in this case I  would  know the types I was returning to. Now, you will see that I have the  node on it & Lt; string & gt;  -  Amatou On the ray  - I'm using it because the reason is that all this strips out all the normal stuff neo4j comes back, and separates  data  - which really  

Returns ((P, D) => New {person} = P AS & lt; dynamic> (), dog = das gt; ()});

But the problem you end here is this That's Neo4jClient Does not work with Ishil and indeed it will return as a object , which lost all of your properties.

You must give at least one starting point, if you need help for a particular type of query, then it should be worth it to enter the query for reference.


Comments