Ejemplo n.º 1
0
        public IEvent Map(EventEntity entity, IClaptrapIdentity identity)
        {
            var eventData =
                _eventDataStringSerializer.Deserialize(identity, entity.EventTypeCode, entity.EventData);
            var dataEvent = new DataEvent(identity, entity.EventTypeCode, eventData)
            {
                Version = entity.Version
            };

            return(dataEvent);
        }
        public IEvent Deserialize(string source)
        {
            var jsonModel = JsonConvert.DeserializeObject <EventJsonModel>(source);
            var eventData = _eventDataStringSerializer.Deserialize(jsonModel.ClaptrapTypeCode,
                                                                   jsonModel.EventTypeCode,
                                                                   jsonModel.DataJson);
            var id = new ClaptrapIdentity(jsonModel.ClaptrapId, jsonModel.ClaptrapTypeCode);
            var re = new DataEvent(id, jsonModel.EventTypeCode, eventData)
            {
                Version = jsonModel.Version
            };

            return(re);
        }