Ejemplo n.º 1
0
        public void event_name_for_event_type()
        {
            var options = new StoreOptions();
            var mapping = new EventMapping<MembersJoined>(new EventGraph(options));

            mapping.EventTypeName.ShouldBe("members_joined");
        }
Ejemplo n.º 2
0
        private void appendEvent(NpgsqlConnection conn, EventMapping eventMapping, Guid stream, IEvent @event)
        {
            if (@event.Id == Guid.Empty)
            {
                @event.Id = Guid.NewGuid();
            }

            conn.CreateSprocCommand("mt_append_event")
            .With("stream", stream)
            .With("stream_type", eventMapping.Stream.StreamTypeName)
            .With("event_id", @event.Id)
            .With("event_type", eventMapping.EventTypeName)
            .With("body", _serializer.ToJson(@event), NpgsqlDbType.Jsonb)
            .ExecuteNonQuery();
        }
Ejemplo n.º 3
0
        private void appendEvent(EventMapping eventMapping, Guid stream, IEvent @event, string streamType)
        {
            if (@event.Id == Guid.Empty)
            {
                @event.Id = Guid.NewGuid();
            }

            _connection.Execute(cmd =>
            {
                cmd.CallsSproc("mt_append_event")
                .With("stream", stream)
                .With("stream_type", streamType)
                .With("event_id", @event.Id)
                .With("event_type", eventMapping.EventTypeName)
                .With("body", _serializer.ToJson(@event), NpgsqlDbType.Jsonb)
                .ExecuteNonQuery();
            });
        }
Ejemplo n.º 4
0
        public void event_name_for_event_type()
        {
            var mapping = new EventMapping(new StreamMapping(typeof(Quest)), typeof(MembersJoined));

            mapping.EventTypeName.ShouldBe("members_joined");
        }