osher elmakayes
osher elmakayes

Reputation: 30

Neo4J C# How to receive different type of Nodes and use them

Lets say for example I have 3 type of nodes TypeA TypeB TypeC and all of the types are inheriting from a Parent type which includes the basic info of node for me, I have this query for example :

var graphResult = graphClient.Cypher
    .Unwind(Nodes, "singleNode")
    .Match("p = (innerNode:TypeA{Id:singleNode.Id}) -[r:CONTAINS {solutionId:{innerSolutionId}}] - ()")
            .WithParam("innerSolutionId", solutionId)
            .Return(p => new
                   {
                      Nodes = Neo4jClient.Cypher.Return.As<IEnumerable<Neo4JNodeDSO>>("nodes(p)"),
                      Relationships = Neo4jClient.Cypher.Return.As<IEnumerable<Neo4JLinkDSO>>("rels(p)")
                   }).Results;

The Nodes that I return are from the Parent type and does not contain all the data of the childrens type, is there a way to devide some how that when I receive data I will have also the properties that belong to TypeA/TypeB/TypeC? and that are not in the parent object? (A way to receive the whole data of every node and not just deserialize it to the Parent Type ? )

Thanks alot in advanced.

Upvotes: 0

Views: 331

Answers (1)

Charlotte Skardon
Charlotte Skardon

Reputation: 6280

Not as the specific type - you can get it as dynamic but you still need to know the type in the long run, this answer: Returning multi value in dynamic query using neo4j client might help as you can bung it out as dynamic - (see the last 'code section').

Upvotes: 0

Related Questions