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

Class ValueObjectMessagePackExtensions

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

Wires value objects into MessagePack serializer options.

public static class ValueObjectMessagePackExtensions

Inheritance​

object ← ValueObjectMessagePackExtensions

Inherited Members​

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

Methods​

WithValueObjects(MessagePackSerializerOptions, bool)​

Returns options whose resolver answers value objects first, then the options' own resolver.

public static MessagePackSerializerOptions WithValueObjects(this MessagePackSerializerOptions options, bool trusted = false)

Parameters​

options MessagePackSerializerOptions

The options, MessagePackSerializerOptions.Standard or the application's own.

trusted bool

Whether value objects are read without validation, for bytes the application alone wrote, a cache among them; false, the default, reads them through their rules.

Returns​

MessagePackSerializerOptions

A copy of options with the resolver in front of theirs.

Remarks​

The resolver of the copy is a composite of , or , and the options' own resolver, which answers every other type: nothing else changes, and included. A value object is then written as the bare value the options' resolver writes for its underlying type, so that a Native* resolver of the chain is honoured.

Called twice, the last call answers value objects first: its trust is the one that applies.

Exceptions​

ArgumentNullException

options is null.