Attributes to save field by reference, value or both

Vote for new features, or make your own requests here.
Post Reply

Attributes to save field by reference, value or both

Yes, I would like this feature
5
100%
No, I would not like this feature
0
No votes
 
Total votes: 5

User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Attributes to save field by reference, value or both

Post by Joel »

Status

Requested

Complexity

5/10

Description

Attributes which can be added to a field to determine whether it is stored by reference, value or both during the serialisation process.
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
RemDust
Posts: 4
Joined: Wed Mar 24, 2021 7:13 pm

Re: Attributes to save field by reference, value or both

Post by RemDust »

I actually came to the forum to request it ^^
Kinda surprise it doesn't have more votes :(
giltar
Posts: 8
Joined: Sun Feb 27, 2022 1:07 pm

Re: Attributes to save field by reference, value or both

Post by giltar »

I really wonder how do people solve this, since it is not implemented yet...:=/
User avatar
Joel
Moodkie Staff
Posts: 4824
Joined: Wed Nov 07, 2012 10:32 pm

Re: Attributes to save field by reference, value or both

Post by Joel »

giltar wrote: Tue Mar 22, 2022 5:28 pm I really wonder how do people solve this, since it is not implemented yet...:=/
Hi there,

To do this you would create an ES3Type (see https://docs.moodkie.com/easy-save-3/es ... g-es3types), and then modify the writer.WriteProperty calls in ES3Type to include the memberReferenceMode parameter.

I.e. instead of this:

Code: Select all

writer.WritePropertyByRef("dict", instance.dict);
Use this:

Code: Select all

writer.WriteProperty("dict", instance.dict, ES3.ReferenceMode.ByRefAndValue);
However, we've seen very few situations where people have needed to do this over the past 10 or so years we've been doing this, which is why it's not explicitly documented and hasn't been implemented as attributes.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply