New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct Deserialization from Binary Driver when using BoltGraphClient #275
base: master
Are you sure you want to change the base?
Direct Deserialization from Binary Driver when using BoltGraphClient #275
Conversation
Hey Arturo, Thanks for this - obviously It'll take some time to go through this - but - when I opened it, one of the tests was failing here , so that'll need to be resolved. I'll try to review the pull request as soon as I can! |
@cskardon I rebased but I forgot to run the tests again afterwards. The fix was rather simple: the new code uses |
Right now missing:
|
@cskardon This is no longer Work in Progress. It could be merged as is, if the given functionality completely meets the expectations. |
Hey Arturo - sorry with the huge pile of GDPR emails this slipped through - I'll look at it today / tomorrow and see what I can do! - Sorry for the delay |
Hi @cskardon any update on this? |
Hey @arturosevilla - I am truly sorry for the time on this - it's a large change and I've unfortunately had work/life get in the way :/ |
I need to work out what to do with this - the problem is that it's a Major version change type pull request as it breaks existing functionality - now - there's not necessarily a huge problem with that kind of thing - but - I'm wary. |
Alright. May I suggest that independently if this would make a major release, or at least a new minor with some deprecated functionality, then maybe see if these changes at least (from your point of view and the project's objectives), meet the following:
|
Hi @arturosevilla , I have a question about the
My understanding is that I would have:
My reason for using The main bit I'm concerned with is the In the old JsonConverter way - I would remove the complex properties from the JsonObject I had, and after that I could just do a simple JsonConvert.Deserialize - is there an equivalent? |
…direct conversion
a24bfb6
to
2d551d7
Compare
@cskardon I'm sorry that I hadn't followed as I was busy with other projects. I am not sure I exactly follow your example. First of all, instead of doing var node = value as INode; You would do: var record = value as IRecord; And of course modify the rest of the code accordingly. I didn't hard coded the Now, returning to your example, I think you are trying to ask if there's a way of doing the following:
var complex = JsonConvert.DeserializeObject<ComplexType>(jsonObject["complexType"]);
jsonObject.Remove("complexType");
var deserialized = JsonConvert.Deserialize(jsonObject);
deserialized.ComplexType = complex;
return deserialized; I'm not sure if I followed exactly, but I would argue that although that might look somewhat cleaner for standard/regular properties (specially if you have a few, or at least more than the complex types), it is not a strategy that would work for everyone. For example, if instead of JSON another encoding would be used, it would depend on that other library. I would even argue that might not be the responsibility of Neo4jClient as that is a functionality provided by the underlying library, that is, Json.NET in this case. In this case In summary, there is no way of doing the exact same thing (if I understand your use-case correctly), but it can definitely still be used to deserialize a complex type. |
Right now the deserializar for
BoltGraphClient
serializes (on a per-record basis) the results into JSON, which is then sent to the existingCypherJsonDeserializer
.This set of changes removes that serialization into JSON by extracting the common functionality of
CypherJsonDeserializer
and creating a newDriverDeserializer
. In this way a change in the deserialization algorithm is not dependent on the underlying serialization.Summary of changes:
CommonDeserializerMethods
and the structure ofCypherJsonDeserializer
was transformed intoBaseDeserializer
which is a generic abstract class that holds the skeleton of the deserializer.DriverSerializer
andCypherJsonDeserializer
implementBaseDeserializer
.CustomJsonDeserializer
usesCypherJsonDeserializer
instead ofCommonDeserializerMethods
.StatementResultHelper
extension methods.DriverDeserializerTests
.DataMemberAttribute
property "renaming" while deserializing andIgnoreDataMemberAttribute
when serializing.DataMemberAttribute
andJsonProperty
while serializing and usingBoltGraphClient
.ITypeSerializer
which substitutesJsonConverter
forBoltGraphClient
.