Class CustomSerializer<T>
- Namespace
- DMediatR
- Assembly
- DMediatR.dll
Generic custom binary serializer to inherit from when implementing a concrete custom serializer for a specific type T. Types deriving from T will also use that serializer.
public abstract class CustomSerializer<T> : Serializer, ISerializer
Type Parameters
T
The concrete type to serialize.
- Inheritance
-
CustomSerializer<T>
- Implements
- Inherited Members
Constructors
CustomSerializer(IServiceProvider)
public CustomSerializer(IServiceProvider serviceProvider)
Parameters
serviceProvider
IServiceProvider
Properties
Type
Use this type of the serialized object as key for services.AddKeyedSingleton().
public static Type Type { get; }
Property Value
Methods
CheckType(Type)
Throws an ArgumentException if the given object is not derived of type T of the generic class.
protected void CheckType(Type givenType)
Parameters
givenType
Type
Exceptions
Deserialize(Type, byte[])
public override object Deserialize(Type type, byte[] bytes)
Parameters
Returns
Deserialize(Type, byte[], bool)
protected object Deserialize(Type type, byte[] bytes, bool checkType)
Parameters
Returns
Serialize(Type, object)
public override byte[] Serialize(Type type, object obj)
Parameters
Returns
- byte[]
Serialize(Type, object, bool)
public byte[] Serialize(Type type, object obj, bool checkType = true)
Parameters
Returns
- byte[]