Example #1
0
        private EventData CreateEventData(ItemWithType @event)
        {
            var metadata = EventMetadata_V1.From(@event);

            var eventData = new EventData(
                Guid.NewGuid(),
                @event.type.Name,
                true,
                System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(@event.instance)),
                MetadataSerializer.Serialize(metadata));

            return(eventData);
        }
        public static EsClientV20.EventData CreateV20EventData(this ItemWithType @event, IDateTimeProvider dateTimeProvider)
        {
            var metadata = EventMetadata_V2.From(@event,
                                                 (MetadataProperties.Timestamp, dateTimeProvider.UtcNow.ToString("yyyy-MM-dd HH:mm:ss")));

            var eventAsJson = JObject.FromObject(@event.instance);

            eventAsJson.Remove(CanEditJsonFieldName);

            return(new EsClientV20.EventData(
                       EsClientV20.Uuid.NewUuid(),
                       @event.type.Name,
                       System.Text.Encoding.UTF8.GetBytes(eventAsJson.ToString()),
                       MetadataSerializer.Serialize(metadata)));
        }
        public static EventData CreateEventData(this ItemWithType @event)
        {
            var metadata = EventMetadata_V1.From(@event);

            var eventAsJson = JObject.FromObject(@event.instance);

            eventAsJson.Remove(CanEditJsonFieldName);

            var eventData = new EventData(
                Guid.NewGuid(),
                @event.type.Name,
                true,
                System.Text.Encoding.UTF8.GetBytes(eventAsJson.ToString()),
                MetadataSerializer.Serialize(metadata));

            return(eventData);
        }