EventJsonModel IEventSerializer <EventJsonModel> .Serialize(IEvent evt) { var id = evt.ClaptrapIdentity; var eventData = _eventDataStringSerializer.Serialize(id, evt.EventTypeCode, evt.Data); var model = new EventJsonModel { Version = evt.Version, ClaptrapId = id.Id, ClaptrapTypeCode = id.TypeCode, EventTypeCode = evt.EventTypeCode, DataJson = eventData }; return(model); }
public EventEntity Map(IEvent @event) { var eventData = _eventDataStringSerializer.Serialize(@event.ClaptrapIdentity, @event.EventTypeCode, @event.Data); var eventEntity = new EventEntity { Version = @event.Version, CreatedTime = _clock.UtcNow, EventData = eventData, EventTypeCode = @event.EventTypeCode, ClaptrapId = @event.ClaptrapIdentity.Id, ClaptrapTypeCode = @event.ClaptrapIdentity.TypeCode }; return(eventEntity); }
public string Serialize(IEvent evt) { var id = evt.ClaptrapIdentity; var eventData = _eventDataStringSerializer.Serialize(id.TypeCode, evt.EventTypeCode, evt.Data); var model = new EventJsonModel { Version = evt.Version, ClaptrapId = id.Id, ClaptrapTypeCode = id.TypeCode, EventTypeCode = evt.EventTypeCode, DataJson = eventData }; var result = JsonConvert.SerializeObject(model); return(result); }