Persistence and Object Reference Management #9289
-
When a grain's dynamic state is persisted, the representative object instances are serialized and deserialized, first when persisted, and again when read back from storage. The serialization upon reinstatement of state leads to multiple objects being created where a single object reference existed in the original state. A simple example would be a single object instance appearing in two separate Lists in the dynamic state. When read from persisted storage, the two lists will contain references to two separate but identical instances of the object. Does Orleans accommodate single object references to be maintained through serialization? Alternatively, I can think of several ways to deal with these scenarios, but are there any recommended best practices? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Assuming you're using System.Text.Json for serialization, you control this yourself: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/preserve-references |
Beta Was this translation helpful? Give feedback.
Assuming you're using System.Text.Json for serialization, you control this yourself: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/preserve-references