Skip to main content
Version: 0.3.x (0.3.0)

Class ValueObjectResolver

Namespace: AdCodicem.ValueObjects.MessagePack
Assembly: AdCodicem.ValueObjects.MessagePack.dll

Answers the formatter of any value object, closed over it at compile time through the descriptor's visitor, and nothing else.

public sealed class ValueObjectResolver : IFormatterResolver

Inheritance​

object ← ValueObjectResolver

Implements​

IFormatterResolver

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

It answers null for any other type, and for a of a value object, so that the next resolver of a composite answers: MessagePack's own NullableFormatter then writes and reads a nil for a TSelf? holding nothing and asks this resolver for TSelf otherwise. Placed first, before StandardResolver, ContractlessStandardResolver or SignalR's own, it is the one MessagePack asks for a value object, which no other resolver writes as its value: StandardResolver knows no formatter for one, and a contractless resolver writes it as an empty map, {}, read back as the default instance.

A value object the registry holds is closed through . One it does not hold yet, a construction of a generic value object nothing registered, a value object written by hand, a value object of a module whose registration has not run, is described by , by reflection, which only the JIT can run. The formatter of each type is built once per resolver and kept.

Properties​

Instance​

Gets the resolver whose formatters read through the value objects' rules.

public static ValueObjectResolver Instance { get; }

Property Value​

ValueObjectResolver

Trusted​

Gets the resolver whose formatters read without validating, for a cache or a store the application alone writes.

public static ValueObjectResolver Trusted { get; }

Property Value​

ValueObjectResolver

Methods​

GetFormatter<T>()​

Gets an instance that can serialize or deserialize some type T.

public IMessagePackFormatter<T>? GetFormatter<T>()

Returns​

IMessagePackFormatter<T>?

A formatter, if this resolver supplies one for type T; otherwise null.

Type Parameters​

T

The type of value to be serialized or deserialized.