Table of Contents

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

Type

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

ArgumentException

Deserialize(Type, byte[])

public override object Deserialize(Type type, byte[] bytes)

Parameters

type Type
bytes byte[]

Returns

object

Deserialize(Type, byte[], bool)

protected object Deserialize(Type type, byte[] bytes, bool checkType)

Parameters

type Type
bytes byte[]
checkType bool

Returns

object

Serialize(Type, object)

public override byte[] Serialize(Type type, object obj)

Parameters

type Type
obj object

Returns

byte[]

Serialize(Type, object, bool)

public byte[] Serialize(Type type, object obj, bool checkType = true)

Parameters

type Type
obj object
checkType bool

Returns

byte[]