Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 3 of 3 total |
Deserialization of complex TCollectionItem descendant |
Wed, Oct 31 2018 7:36 AM | Permanent Link |
ooptimum | In my app I need to take some tree-like structure from a server. I don't want use datasets for the sake of code clearness and productivity, since instead of making multiple requests via datasets and handling received data thereafter, I can pass the whole tree as a serialized TCollection object, which then can be used directly. However, I was faced with the fact that although the entire tree is serialized completely, only the top level is preserved during deserialization. Is this some kind of misunderstanding by me or I found a bug, which I have to report? An example is attached.
Attachments: deserialization.zip |
Mon, Nov 12 2018 2:06 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Sorry for the delay in responding.
<< In my app I need to take some tree-like structure from a server. I don't want use datasets for the sake of code clearness and productivity, since instead of making multiple requests via datasets and handling received data thereafter, I can pass the whole tree as a serialized TCollection object, which then can be used directly. However, I was faced with the fact that although the entire tree is serialized completely, only the top level is preserved during deserialization. Is this some kind of misunderstanding by me or I found a bug, which I have to report? An example is attached. >> The issue is that you aren't creating the collection for each key item as part of the creation of the key item. Therefore, when the persistence layer tries to load the collection, it can't because the collection instance is nil (EWB will *not* automatically create instances of properties for you at runtime during loading, it will simply just load them if they are already instantiated). The solution is to just move the sub-tree collection creation into the key items. Tim Young Elevate Software www.elevatesoft.com |
Wed, Nov 14 2018 7:22 AM | Permanent Link |
ooptimum | << The solution is to just move the sub-tree collection creation into the key items.>>
Thank you. This constructor did the magic (maybe it will be helpful to someone else): constructor TKeyValueItem.Create(ACollection: TCollection); begin inherited Create(ACollection); Subtree := TKeyValueCollection.Create; end; |
This web page was last updated on Friday, November 1, 2024 at 07:01 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |