示例#1
0
        public async Task Execute()
        {
            string query;
            ParametersContainer parameters;

            if (IsEmpty)
            {
                return;
            }

            _combinedRawQuery.Render(out query, out parameters);

            Console.WriteLine(query);

            await _connectionCreator(async (connection, transaction) => {
                using var cmd = new NpgsqlCommand(query, connection, transaction);

                parameters.AssignToCommand(cmd);

                using var reader = await cmd.ExecuteReaderAsync();

                foreach (var operation in _resultProcessors)
                {
                    await operation(reader);
                }

                await reader.CloseAsync();
            });
        }
示例#2
0
        public static void AssertRawQuery(RawQuery rq, string expectedQuery, params Param[] parameters)
        {
            if (expectedQuery == null)
            {
                throw new ArgumentNullException(nameof(expectedQuery));
            }

            string query;
            ParametersContainer outParameters;

            rq.SkipExplicitColumnTableNames();
            rq.Render(out query, out outParameters);