Open
Description
Currently we only serialize things as json. Ideally, we need an interface or something that you can implement (or pass as a parameter in the attribute) to provide a custom serialization mechanism.
The interface will be something like
public interface IPersistentComponentStateSerializer
{
Task Persist(Type type, object instance, IBufferWriter buffer);
void Restore(Type type, ReadOnlySequence<byte> data);
}
- Restore needs to be synchronous to avoid tearing on the UI.
- We don't want
byte[]
based APIs, as we want to minimize additional allocations if possible and we don't want to give the serializer the responsibility of allocating buffers.