CompositeBinarySerializer Class
Abblix.Oidc.Server
Abblix.Oidc.Server.Features.Storages
CompositeBinarySerializer Class
A composite serializer that tries Protocol Buffers first, then falls back to JSON for unsupported types.
public class CompositeBinarySerializer : Abblix.Oidc.Server.Common.Interfaces.IBinarySerializer
Inheritance System.Object → CompositeBinarySerializer
Implements IBinarySerializer
Constructors
CompositeBinarySerializer(ILogger<CompositeBinarySerializer>, IBinarySerializer, IBinarySerializer) Constructor
A composite serializer that tries Protocol Buffers first, then falls back to JSON for unsupported types.
public CompositeBinarySerializer(Microsoft.Extensions.Logging.ILogger<Abblix.Oidc.Server.Features.Storages.CompositeBinarySerializer> logger, Abblix.Oidc.Server.Common.Interfaces.IBinarySerializer protobufSerializer, Abblix.Oidc.Server.Common.Interfaces.IBinarySerializer jsonSerializer);
Parameters
logger Microsoft.Extensions.Logging.ILogger<CompositeBinarySerializer>
The logger for recording fallback warnings.
protobufSerializer IBinarySerializer
The Protocol Buffers serializer.
jsonSerializer IBinarySerializer
The JSON serializer fallback.
Methods
CompositeBinarySerializer.Deserialize<T>(byte[]) Method
Deserializes a binary representation using Protocol Buffers if supported, otherwise falls back to JSON.
public T? Deserialize<T>(byte[] bytes);
Type parameters
T
The type of the object to deserialize into.
Parameters
bytes System.Byte[]
The binary representation to deserialize from.
Implements Deserialize<T>(byte[])
Returns
T
The deserialized object of type T.
CompositeBinarySerializer.Serialize<T>(T) Method
Serializes an object using Protocol Buffers if supported, otherwise falls back to JSON.
public byte[] Serialize<T>(T obj);
Type parameters
T
The type of the object to serialize.
Parameters
obj T
The object to serialize.
Implements Serialize<T>(T)
Returns
System.Byte[]
A byte array representing the serialized object.