Closed filt3rek closed 5 years ago
If you create manually the instance, you need to set its uid property using `inst.uid = @:privateAccess hxbit.Serializer.allocUID()`
Thanks for your answer Nicolas,
But I try to use it with record-macros and it createEmptyInstance by itself, I can't modify that. Is there any alternative to use it with record-macros like that ?
Maybe, you can subclass the serializer, and if when serializing an object its __uid is 0/null you can set it before calling the super method.
As I see, hxBit adds uid in the constructor. Maybe if we use a getter for uid (where we set the uid) instead of setting it in the constructor it would work for all ? Is it a bad idea ?
subclassing the serializer is better
Hej,
I just gave a try to hxBit, only the serializer part. I wanted to do some bench to compare with the traditionnal haxe.Serializer, to pass DB objects (record-macros) from Server to Client and I get "null" when unserializing. I tried with another instance class (not a DB object) but using with Type.createEmptyInstance and it gives me "null" also. So I think it comes from here (Type.createEmptyInstance). Is there a way to make it work with that please ?
Thanks for reading, Michal