Exemplo n.º 1
0
        // You should provide your own implementation of this method if you need
        // to customize the serialization.
        private static byte[] GetBytesInEvent(EventData eData)
        {
            var eventToPersist = new ColdStorageEvent();

            eventToPersist.Offset     = eData.Offset;
            eventToPersist.Properties = GetStringDictionary(eData.Properties);
            try
            {
                //We are asuming serialization and encoding from the sender.
                eventToPersist.Payload = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(eData.GetBytes()));
            }
            catch (JsonReaderException)
            {
                eventToPersist.Payload = Encoding.UTF8.GetString(eData.GetBytes());
            }
            return(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(eventToPersist) + EventDelimiter));
        }
 // You should provide your own implementation of this method if you need 
 // to customize the serialization.
 private static byte[] GetBytesInEvent(EventData eData)
 {
     var eventToPersist = new ColdStorageEvent();
     eventToPersist.Offset = eData.Offset;
     eventToPersist.Properties = GetStringDictionary(eData.Properties);
     try
     {
         //We are asuming serialization and encoding from the sender.
         eventToPersist.Payload = JsonConvert.DeserializeObject(Encoding.UTF8.GetString(eData.GetBytes()));
     }
     catch (JsonReaderException)
     {
         eventToPersist.Payload = Encoding.UTF8.GetString(eData.GetBytes());
     }
     return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(eventToPersist) + EventDelimiter);
 }