The serialiser gets confused which object to deserialize if type is dictionary.
See original GitHub issueFollowing code works fine in first search when you cast node as dictionary as “root”, but if it’s assigned to property of anonymous or typed object, then it decides that your node is Node object and gets it’s properties. I think it might be related to v 1.1 change of return type of enumerator
void Main()
{
var graph = new GraphClient(new Uri($"http://localhost:7474/db/data"), "neo4j", "neo4j");
graph.Connect();
var r1 = new Dictionary<string, string>() { { "Id", "1" }, { "Name", "First" }};
graph.Cypher
.Create("(node:Record {entity})")
.WithParam("entity", r1)
.ExecuteWithoutResults();
var result = graph.Cypher
.Match("(node:Record)")
.Where((Record node) => node.Id == "1")
.Return((node) => node.As<Dictionary<string, string>>() )
.Results;
result.Dump();
var resultNode = graph.Cypher
.Match("(node:Record)")
.Where((Record node) => node.Id == "1")
.Return((node) => new { Record = node.As<Dictionary<string, string>>()})
.Results;
resultNode.Dump() ;
}
public class Record
{
public string Id { get; set; }
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
c# - How To Serialize a class that derives from a Dictionary
1 Answer. Because your dictionary has both a complex key and additional properties, you will need to use a custom JsonConverter to serialize ......
Read more >Polymorphic Deserialization throws if $type metadata isn't ...
Attempting to deserialize a polymorphic structure with System.Text.Json that doesn't feature $type at start of the object results in an ...
Read more >C# How to serialize/deserialize an Object to/from ...
If I want to store data as Document in Clouchbase.lite is has to be in the form of Dictionary like this: var properties...
Read more >How to serialize and deserialize dictionaries using BitBuffer?
I want to serialize and deserialize a dictionary, but the dictionary is dynamic. The BitBuffer library I am using: GitHub - rstk/BitBuffer: Fast...
Read more >What, Why and How of (De)Serialization in Python
The reversed process is called deserialization, which means reconverting a sequence of bytes into a structured object.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m closing this as it looks like it’s gone to hibernation - any objections please reopen! ta!
In terms of your second question regarding what you’d pull back for
ref=node-[r:Reference]-(rfr)
the data back from Neo4j itself is a collection of Urls to the nodes and relationships, the default way to look at that is:.Return<PathsResult>("ref");
Problem for you is that you probably don’t want
PathsResult
instances, as that’s just links and pretty useless - what you’d be more after would be converting to Node/Relationship instances - I wrote a post a long time ago - but it should be still valid (http://geekswithblogs.net/cskardon/archive/2013/07/23/neo4jclient-ndash-getting-path-results.aspx) covering that aspect…