ProtobufSerializer Class
Provides functionality to serialize and deserialize objects to and from Protocol Buffer binary representations. Implements the IBinarySerializer interface using Google.Protobuf for efficient serialization.
public class ProtobufSerializer : Abblix.Oidc.Server.Common.Interfaces.IBinarySerializerInheritance System.Object → ProtobufSerializer
Implements IBinarySerializer
Remarks
This serializer supports only specific OIDC storage types that have protobuf definitions and mappers. Attempting to serialize unsupported types will throw InvalidOperationException.
Methods
ProtobufSerializer.Deserialize<T>(byte[]) Method
Deserializes a binary representation to an object using Protocol Buffers.
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.
Exceptions
System.InvalidOperationException
Thrown when the type is not supported for protobuf deserialization.
ProtobufSerializer.Serialize<T>(T) Method
Serializes an object to a binary representation using Protocol Buffers.
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.
Exceptions
System.InvalidOperationException
Thrown when the type is not supported for protobuf serialization.