Class ValueObjectHubProtocolExtensions
Namespace: AdCodicem.ValueObjects.MessagePack
Assembly: AdCodicem.ValueObjects.MessagePack.dll
Wires value objects into SignalR's MessagePack hub protocol, on the server and on the .NET client alike.
public static class ValueObjectHubProtocolExtensions
Inheritance
object ← ValueObjectHubProtocolExtensions
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
UseValueObjects(MessagePackHubProtocolOptions, bool)
Puts the value-object resolver in front of the hub protocol's own, keeping its security and its other settings.
public static MessagePackHubProtocolOptions UseValueObjects(this MessagePackHubProtocolOptions options, bool trusted = false)
Parameters
options MessagePackHubProtocolOptions
The hub protocol's options, as AddMessagePackProtocol hands them.
trusted bool
Whether value objects are read without validation; false, the default, reads them through their rules, as a hub reading what clients send should.
Returns
The same options, so that calls can be chained.
Remarks
SignalR's own resolver falls back to contractless serialization, which writes a value object as an empty map,
{}, read back as the default instance, with nothing thrown. With this call, a value object travels as the
bare value of its underlying type, and an argument the value object refuses fails the invocation before the hub
method runs. Both ends need it: a client that does not call it writes {}, which a server that does refuses,
and a server that does not reads what such a client writes as the default instance.
Exceptions
options is null.