I'm using the Neo4jClient to create nodes in neo4j and would like to know if there is a way to serialize and deserialize objects against .net types which contain dictionaries to hold values for all the node properties. The reason for this is that the number of properties can vary over time.For example, I'd like to be able to do the following:public class Order{public int OrderId { get; set; }public Dictionary<string, string> Attributes { get; set; }}When (using the Neo4jClient) I read in the value of a node and convert it to an Order type, each property in the node will get added to the dictionary of Attributes.Likewise, when I save an object of this structure I need be able to extract all the values in the Attributes dictionary and generate against the node for each property.
{ "columns" : [ "n" ], "data" : [ [ { "labels" : "http://localhost:7474/db/data/node/44/labels", "outgoing_relationships" : "http://localhost:7474/db/data/node/44/relationships/out", "data" : { "position" : "Developer", "awesome" : true, "name" : "Michael", "children" : 3 }, "traverse" : "http://localhost:7474/db/data/node/44/traverse/{returnType}", "all_typed_relationships" : "http://localhost:7474/db/data/node/44/relationships/all/{-list|&|types}", "property" : "http://localhost:7474/db/data/node/44/properties/{key}", "self" : "http://localhost:7474/db/data/node/44", "outgoing_typed_relationships" : "http://localhost:7474/db/data/node/44/relationships/out/{-list|&|types}", "properties" : "http://localhost:7474/db/data/node/44/properties", "incoming_relationships" : "http://localhost:7474/db/data/node/44/relationships/in", "extensions" : { }, "create_relationship" : "http://localhost:7474/db/data/node/44/relationships", "paged_traverse" : "http://localhost:7474/db/data/node/44/paged/traverse/{returnType}{?pageSize,leaseTime}", "all_relationships" : "http://localhost:7474/db/data/node/44/relationships/all", "incoming_typed_relationships" : "http://localhost:7474/db/data/node/44/relationships/in/{-list|&|types}" } ] ] }
Now deserialize this into .NET objects. Each key is a column and each data are the values.
It's not possible to do this with Neo4jClient, so you'll need to write your own extension of Neo4jClient to handle this using serialization. I recommend using http://json2csharp.com/ to generate your .NET objects from JSON.
Thanks,
Kenny