Ejemplo n.º 1
0
        public async Task <Application.SearchResult> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var model  = Model;
            var result = new Application.SearchResult();

            using var connection = await OpenConnectionAsync(cancellationToken);

            await _commandProvider.ExecuteAsync(model, result, connection, cancellationToken);

            return(result);
        }
Ejemplo n.º 2
0
        public async Task ExecuteAsync(Application.SearchModel model, Application.SearchResult result, SqlConnection connection, CancellationToken cancellationToken = default)
        {
            using var command = Get(model, connection);
            using var reader  = await command.ExecuteReaderAsync(cancellationToken);

            if (reader.HasRows)
            {
                while (await reader.ReadAsync(cancellationToken))
                {
                    result.Applications.Add(_readerConverter.Convert(reader));
                }
            }

            result.TotalCount = await ReadTotalCountAsync(reader, cancellationToken);
        }