Exemple #1
0
 public void AppendToStore(string name, ICollection <MessageAttribute> attribs, long streamVersion, ICollection <object> messages)
 {
     using (var mem = new MemoryStream())
     {
         _serializer.WriteAttributes(attribs, mem);
         _serializer.WriteCompactInt(messages.Count(), mem);
         foreach (var message in messages)
         {
             _serializer.WriteMessage(message, message.GetType(), mem);
         }
         _appendOnlyStore.Append(name, mem.ToArray(), streamVersion);
     }
 }
Exemple #2
0
        public byte[] SaveEnvelopeData(ImmutableEnvelope envelope)
        {
            using (var mem = new MemoryStream())
            {
                byte[] data;
                using (var block = new MemoryStream())
                {
                    MessageSerializer.WriteAttributes(envelope.Attributes, block);
                    MessageSerializer.WriteMessage(envelope.Message, envelope.Message.GetType(), block);
                    data = block.ToArray();
                }

                MessageSerializer.WriteCompactInt(Signature, mem);

                StorageFramesEvil.WriteFrame(envelope.EnvelopeId, DateTime.UtcNow.Ticks, data, mem);
                return(mem.ToArray());
            }
        }