//
        // Event data
        //

        internal static EventData GetAreaEventData(
            this EventStoreContext context,
            Event e,
            TimelinePosition cause,
            DateTimeOffset when,
            DateTimeOffset?whenOccurs,
            Id eventId,
            Id commandId,
            Id userId,
            FlowKey topic,
            Many <FlowKey> routes)
        {
            var type = context.GetEventType(e);

            var metadata = new AreaEventMetadata
            {
                Cause      = cause,
                When       = when,
                WhenOccurs = whenOccurs,
                CommandId  = commandId,
                UserId     = userId,
                Topic      = topic
            };

            metadata.ApplyRoutes(type, routes);

            return(new EventData(
                       eventId.IsUnassigned ? Guid.NewGuid() : Guid.Parse(eventId.ToString()),
                       type.ToString(),
                       isJson: true,
                       data: context.ToJson(e),
                       metadata: context.ToJson(metadata)));
        }
 internal static EventData GetCheckpointEventData(this EventStoreContext context, Flow flow) =>
 new EventData(
     Guid.NewGuid(),
     "timeline:Checkpoint",
     isJson: true,
     data: context.ToJson(flow),
     metadata: context.ToJson(new CheckpointMetadata
 {
     Position      = flow.Context.CheckpointPosition,
     ErrorPosition = flow.Context.ErrorPosition
 }));
 internal static EventData GetQueryChangedEventData(this EventStoreContext context, QueryChanged e) =>
 new EventData(
     Guid.NewGuid(),
     "timeline:QueryChanged",
     isJson: true,
     data: context.ToJson(e),
     metadata: null);
Пример #4
0
 internal static EventData GetClientEventData(this EventStoreContext context, Event e) =>
 new EventData(
     Guid.NewGuid(),
     $"timeline:{e.GetType().Name}",
     isJson: true,
     data: context.ToJson(e),
     metadata: null);