예제 #1
0
        public void CallsSproc_extension_method()
        {
            var command = new NpgsqlCommand();

            command.CallsSproc(new DbObjectName("foo", "func")).ShouldBeSameAs(command);
            command.CommandType.ShouldBe(CommandType.StoredProcedure);
            command.CommandText.ShouldBe("foo.func");
        }
예제 #2
0
        public void CallsSproc_extension_method_by_string()
        {
            var command = new NpgsqlCommand();

            command.CallsSproc("foo.func").ShouldBeSameAs(command);
            command.CommandType.ShouldBe(CommandType.StoredProcedure);
            command.CommandText.ShouldBe("foo.func");
        }
예제 #3
0
        private void appendEvent(NpgsqlCommand conn, EventMapping eventMapping, Guid stream, IEvent @event)
        {
            if (@event.Id == Guid.Empty)
            {
                @event.Id = Guid.NewGuid();
            }

            conn.CallsSproc("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();
        }