Bytes after the value: a payload is one MessagePack value (C#) (#125)
This commit is contained in:
parent
a8c2825745
commit
5e10909fe9
21 changed files with 441 additions and 30 deletions
|
|
@ -641,23 +641,19 @@ namespace GameCult.Networking
|
|||
string storedAt,
|
||||
CultNetDocumentMessageOptions? options = null)
|
||||
{
|
||||
var binding = GetByDocumentType(descriptor.DocumentType) ??
|
||||
new CultNetDocumentBinding(
|
||||
descriptor.DocumentType,
|
||||
descriptor.SchemaId,
|
||||
value => CultDocumentMessagePackSerialization.SerializeUntyped(value, value.GetType(), _documents),
|
||||
payload => CultDocumentMessagePackSerialization.DeserializeUntyped(descriptor.DocumentType, payload, _documents));
|
||||
var binding = GetByDocumentType(descriptor.DocumentType);
|
||||
|
||||
return new CultNetRawDocumentRecord
|
||||
{
|
||||
SchemaId = binding.SchemaId,
|
||||
SchemaId = binding?.SchemaId ?? descriptor.SchemaId,
|
||||
SchemaName = descriptor.SchemaName,
|
||||
SchemaVersion = descriptor.SchemaVersion,
|
||||
SchemaContentHash = descriptor.ContentHash,
|
||||
RecordKey = key.Value,
|
||||
StoredAt = storedAt,
|
||||
PayloadEncoding = "messagepack",
|
||||
Payload = binding.PayloadSerializer(document),
|
||||
Payload = binding?.PayloadSerializer(document) ??
|
||||
CultDocumentMessagePackSerialization.SerializeUntyped(document, document.GetType(), _documents),
|
||||
SourceRuntimeId = options?.SourceRuntimeId,
|
||||
SourceAgentId = options?.SourceAgentId,
|
||||
SourceRole = options?.SourceRole,
|
||||
|
|
|
|||
Loading…
Reference in a new issue