Interface ITypeSerializer
Non-generic base interface for type serializers used by the Scylla serialization engine for runtime type resolution and registration.
Namespace: Scylla.Core.Util.Serialization
Assembly: ScyllaCore.dll
Syntax
public interface ITypeSerializer
Remarks
This interface exists primarily to allow heterogeneous collections of type serializers to be stored and retrieved by Type key at runtime without requiring generic type arguments at the call site. The engine resolves the correct serializer via GetSerializer(Type) and then calls WriteObject(object, IScyllaWriter, ISerializationContext) or ReadObject(IScyllaReader, ISerializationContext).
Most application code should implement the strongly-typed ITypeSerializer<T> instead and register it through RegisterSerializer<T>(ITypeSerializer<T>) or RegisterSerializer<T>(ITypeSerializer<T>). The engine wraps it in a TypeSerializerAdapter<T> automatically, bridging to this non-generic interface.
Properties
TargetType
Gets the Type that this serializer is responsible for handling. The engine uses this value as the dictionary key when storing and retrieving serializers from its registry.
Declaration
Type TargetType { get; }
Property Value
| Type | Description |
|---|---|
| Type | The exact Type this serializer handles. For
TypeSerializerAdapter<T>, this is always |
Methods
ReadObject(IScyllaReader, ISerializationContext)
Reads and reconstructs a value from reader using this
serializer's format-specific decoding. This is the non-generic counterpart of
Read(IScyllaReader, ISerializationContext).
Declaration
object ReadObject(IScyllaReader reader, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IScyllaReader | reader | The format-specific reader positioned at the beginning of the serialized value.
Must not be |
| ISerializationContext | context | The active serialization context providing settings, depth tracking, and reference
tracking. Must not be |
Returns
| Type | Description |
|---|---|
| object | The deserialized value as a boxed object. May return |
See Also
WriteObject(object, IScyllaWriter, ISerializationContext)
Writes the supplied value to writer using this serializer's
format-specific encoding. This is the non-generic counterpart of
Write(T, IScyllaWriter, ISerializationContext).
Declaration
void WriteObject(object value, IScyllaWriter writer, ISerializationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The object to serialize. May be |
| IScyllaWriter | writer | The format-specific writer that receives the serialized output (e.g., a JSON
or binary stream). Must not be |
| ISerializationContext | context | The active serialization context, providing access to settings, depth tracking,
and reference tracking for the ongoing operation. Must not be |