Generate explicit CultCache payload codecs
This commit is contained in:
parent
8606b74d65
commit
c26870b803
7 changed files with 135 additions and 15 deletions
|
|
@ -45,11 +45,26 @@ public static class CultDocumentMessagePackSerialization
|
|||
|
||||
public static byte[] SerializeUntyped(object value, Type type)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
var descriptor = CultDocumentRegistry.Shared.GetRequired(type);
|
||||
if (descriptor.GeneratedPayloadSerializer != null)
|
||||
{
|
||||
return descriptor.GeneratedPayloadSerializer(value);
|
||||
}
|
||||
}
|
||||
|
||||
return MessagePackSerializer.Serialize(type, value, Options);
|
||||
}
|
||||
|
||||
public static object DeserializeUntyped(Type type, byte[] payload)
|
||||
{
|
||||
var descriptor = CultDocumentRegistry.Shared.GetRequired(type);
|
||||
if (descriptor.GeneratedPayloadDeserializer != null)
|
||||
{
|
||||
return descriptor.GeneratedPayloadDeserializer(payload);
|
||||
}
|
||||
|
||||
return MessagePackSerializer.Deserialize(type, payload, Options);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue